<headername> is for(and should be) standard libraries, one that is common in nature with the compiler. You can try using "headername" for linked ones.
#include <iostream>
this should also be located in lib/DerClass since you are using std::cout in the definition of the class and NOT on the class declaration(the one in hpp).
Also note that it would be better to put them in the same directories so as to not have problems like these. But if you really want to, you can set your compiler to do that in your includes. For more info about how to do this, visit your IDE/compiler site and see how to 'link' them up(usually in this case, just search for how to include files in compiler name).
I changed the #include to quotes and moved all files into the same directory as you suggested.
Also removed the std::cout from the function, so that is no longer an issue.
Still getting the same error though.
main.cpp
1 2 3 4 5 6 7 8 9
#include "DerClass.h"
int main()
{
DerClass der1;
der1.fn(); //undefined reference to `DerClass::fn()'
//compiles when this line is commented
}
C:\Users\wolf\Documents\demo_MinGW\inherit>g++ -Wall main.cp
p
C:\Users\wolf\AppData\Local\Temp\ccKX706N.o:main.cpp:(.text+0x15): undefined ref
erence to `DerClass::fn()'
collect2.exe: error: ld returned 1 exit status