Im compiling the following code using g++ on redhat 7.3:
Code://clim.cpp: #include <iostream.h> #include "client.h" int main(int args, char* argv[]) { int retVal; retVal=Client->load(args,argv[1]); cout << retVal << endl; return retVal; } //client.h #include <ncurses.h> #include <stdlib.h> class clim { private: public: long load(int args,char* argv); }; clim* Client; //client.cpp #include "client.h" #include <iostream.h> long clim::load(int args, char* argv) { cout << "load" << endl; return 20; }
Now why doesnt that work?
When in CLi, I get an error "undefined reference to 'load'" and when in GUI, I get the error "undefined reference to 'main'
Both errors stem from an output file with a random filename, like cfkjd94..
Then collect2 says that ld returned a 1 exit status, whatever that means...





Reply With Quote