What exactly is the problem you are having?
C:\Users\Cayle\AppData\Local\Temp\ccn4zg2n.o:main.cpp:(.text+0x15): undefined reference to `MyClass::foo()'
collect2.exe: error: ld returned 1 exit status
It seems like your class is not being linked properly is your header filer a .h or .hpp you are including a .hpp but your comments suggest it is a .h.
Also that second error means you never closed the old one before trying to open a new one..Maybe try and close the old and compile/build/run a new one. The code you posted though should work.
All of my files are .cpp/.hpp the second error went away as you said. I tried changing the header to .h and the same error still came up.
Last edited on