Jump to content
  • Advertisement
Sign in to follow this  
Mr_Od86

How to add implementation files to a project in dev-c++

This topic is 3626 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I'm currently trying to compile code from a book. (OpenGL superbible) It uses a header file which links to several implementation files. When I just include the header file in my code I get a linker error [Linker Error] undefined reference to 'gltTransformPoint'. I think I have to add the source code that containts the implementation files to my project, but I don't know how to do that, I'm using dev-c++5. The implementation files reside in a folder in the cd that came with the book. Do I specify this folder in the project options, or what do I do?? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Googol PL3X
Have you linked to the header files or the libs?



I wouldn't know how to do that, all programs I have looked at so far haven't required seperate files. I know the location of the folder with the implementations, but I don't know how to link that folder to my project. Any suggestions will be appreciated!

Share this post


Link to post
Share on other sites
I'm not so familiar with OpenGL and Dev c++ (rather directx and vsc++) but what you need to do is download the openGL SDK and then you can link the libs and headers to your program, then it should all compile nicely.

Share this post


Link to post
Share on other sites
Sorry, I wasn't being very clear, I got openGL running and everything, that's not a problem. It's just that the example uses a special vector class that the author wrote his own header file for <gltools.h>, i think it defines some special data structures. I just wanted to know generally how to link implementation files that are located in a seperate folder apart from the source file with the main() function. Hope I made my problem a bit more clear.

Also if I understand correctly library files (or pre-compiled files) got like a .o extension, i looked for those files in the folder, but didn't find them.

Share this post


Link to post
Share on other sites
I assume there is either a gltools.c or gltools.cpp file that came with gltools.h. You will need to add that file to the project.

Share this post


Link to post
Share on other sites
There's either

- a matching source file (.c or .cpp) to the gltools.h, which you have to compile (just add it to the project using the "Project" menu)
- a matching already-compiled file (called library, ends with .a or .lib), which you have to link to your EXE file (Project options > Parameters > Add library/object)

Hope that helps. My Dev-C++ is in German, but I think you'll find the roughly translated menu points ;)

Share this post


Link to post
Share on other sites
Quote:
Original post by AndiDog
There's either

- a matching source file (.c or .cpp) to the gltools.h, which you have to compile (just add it to the project using the "Project" menu)
- a matching already-compiled file (called library, ends with .a or .lib), which you have to link to your EXE file (Project options > Parameters > Add library/object)

Hope that helps. My Dev-C++ is in German, but I think you'll find the roughly translated menu points ;)


There is no matching source file unfortunately nor a matching library file. I have checked both the folder where the header file is located and the folder with the main() source file.

The specific error that I get when trying to compile is


[Linker error] undefined reference to `gltTransformPoint(float const*, float const*, float*)'


the function gltTransformPoint is implemented in a file called vectorMath.c and declared in the header file gltools.h


//The following code is in gltools.h
// vector functions in VectorMath.c
void gltAddVectors(const GLTVector3 vFirst, const GLTVector3 vSecond, GLTVector3 vResult);
void gltSubtractVectors(const GLTVector3 vFirst, const GLTVector3 vSecond, GLTVector3 vResult);
void gltScaleVector(GLTVector3 vVector, const GLfloat fScale);
GLfloat gltGetVectorLengthSqrd(const GLTVector3 vVector);
GLfloat gltGetVectorLength(const GLTVector3 vVector);
void gltNormalizeVector(GLTVector3 vNormal);
void gltGetNormalVector(const GLTVector3 vP1, const GLTVector3 vP2, const GLTVector3 vP3, GLTVector3 vNormal);
void gltCopyVector(const GLTVector3 vSource, GLTVector3 vDest);
GLfloat gltVectorDotProduct(const GLTVector3 u, const GLTVector3 v);
void gltVectorCrossProduct(const GLTVector3 vU, const GLTVector3 vV, GLTVector3 vResult);
void gltTransformPoint(const GLTVector3 vSrcPoint, const GLTMatrix mMatrix, GLTVector3 vPointOut);


Apart from vectorMath.c there are also other files needed by gltools.h, should I add all these files to my project, or add them as include statements??

Share this post


Link to post
Share on other sites
You should add them to your project. Don't use the include statement, this isn't usual for source code files (only for headers!).

Share this post


Link to post
Share on other sites
Quote:
Original post by AndiDog
You should add them to your project. Don't use the include statement, this isn't usual for source code files (only for headers!).


These files are all conveniently located in a folder. Is it possible to add this folder to my project, or at least make the files within the folder visible to my project. I imagine if thats possible that would be easier than adding like ten source files.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!