I have a libcx3d.a which contains my VrmlParser class and other classes which are used by VrmlParser. I have a main.cpp which does this :
VrmlParser vp = new VrmlParser();
double **VOB = vp.getVOB();
When I compile using g++ main.cpp -o main -L. -lcx3d, I get the following errors :
'VrmlParser' was not declared in this scope.
expected ';' before vp.
'vp' was not declared in this scope.
There is a header file called "VrmlParser.h" in the static library. Should I include this header file in main.cpp ? If so, will include "VrmlParser.h" work ? I have the .a and .cpp in the same directory. I can't find the header file for the static library.
I ran the above command and the following got printed :
main.o: In function `main':
main.cpp:(.text+0x18): undefined reference to `CyberX3D::VrmlParser::VrmlParser()'
main.cpp:(.text+0x20): undefined reference to `CyberX3D::VrmlParser::getVOB()'
collect2: ld returned 1 exit status
Initially, I built the static library through cygwin and transferred the libcx3d.a to the remote server on which I plan to run my application. When I built the library again on the server and then linked to it, it worked.