Archived

This topic is now archived and is closed to further replies.

Linking my code

This topic is 5742 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

Hi there... I''m not very good at c++ coding, so I guess this is pretty elementary: I use several .cpp files and one header file for my project (VC6.0). My header starts off with #if !defined _OPENGL_H_ #define _OPENGL_H_ and is terminated with #endif. Then I try to put universal variables and stuff here. Still, the compiler complains about for example "hWnd already defined in OpenGL.lib. But that''s not tru! I have not defined it twice. What is wrong?

Share this post


Link to post
Share on other sites
I had a certain relational problem like this with Dev-C++ v5.0 beta, but I did issue it twice*I didn''t know untill the darn errors came up*, try using the include:
#include "filenamehere.h" put change the "filenamehere" to the filename, and change the ".h" to a .h, .hpp, or something like that

If you care about her/him, you''''ll listen
If you love her/him, you''''ll heal his/her wounds
If you like her/him, you''''ll do all of the above, and help her/him in need

A person who cares is a person who never speaks

Share this post


Link to post
Share on other sites
Don''t declare variables in header files. Declare them in source files. Put extern references in the header file so that the variable becomes visible in all files that include the header.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]

Share this post


Link to post
Share on other sites