Why does the following code get link error "undefined reference to" function?
I copied the lines into a single file and it worked.
So maybe there is something wrong with the #includes, but I don't see what is wrong.
Please take a look.
C:\demo_MinGW\link_composite2>g++ main.cpp
C:\Users\wolf\AppData\Local\Temp\ccSNvt8X.o:main.cpp:(.text+0x15): undefined ref
erence to `Child1::fc()'
C:\Users\wolf\AppData\Local\Temp\ccSNvt8X.o:main.cpp:(.text+0x20): undefined ref
erence to `Child2::fc()'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: C:\Users\w
olf\AppData\Local\Temp\ccSNvt8X.o: bad reloc address 0x0 in section `.ctors'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link
failed: Invalid operation
collect2.exe: error: ld returned 1 exit status