at school im learning C++ with Visual Studio and we have now comed to classes within multiple files. At home I prefer using Geany with gnuc and thereby I tried to compile the same three files I have succesfully tested with Windows, but it won't work. This is the first error-message (they are all of the same kind):
main.cpp:(.text+0x19): undefined reference to 'PiggyBank::init(int)'
Seems like if the other two files weren't included right, doesn't it?
These are the files (unnecessary code is replaced by '...'):
They are all in the same folder. Has anyone an idea what the problem could be? I would be very grateful for beeing able to continue coding with Linux. Thanks in advance.
im not quite sure how to add files to geany but if you do it via command line: g++ main.cpp PiggyBank.cpp -o piggybank
whenever i have multiple c++ files i just use make however. you write the commands you want in a special script called a makefile, then just run make