Public Group

#### Archived

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

# Stupid newbie errors

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

## Recommended Posts

#ifndef MAIN
#define MAIN
...
//Do everything I need to do
...
#endif 
But that didn''t work. Can anyone help out a poor newbie who is trying to use OpenGL?

##### Share on other sites
Never include source (.c, .cpp) files. Only include headers. The header should preferably begin with a #ifndef/#define/#endif structure, as you indicated, but the source files should not be included -- merely compiled and linked in the same project.

##### Share on other sites
I didn't include the .cpp files, only main.h
And I tried using the #ifndef/#define/#endif but it didn't work =(

*Edit* I got around the problem for the time being, but I still need to know how to do this for later on

[edited by - Kaezin on July 28, 2002 5:37:38 PM]

##### Share on other sites
Ah, I see -- I should have seen it at once. Perhaps you have defined variables in the header files rather than the source files? This should never be done -- declare the variables as extern in the header and define it in a source file somewhere (you have to re-declare it). Someone wrote an excellent article on just this sort of problems on GameDev not too many months ago ... try searching for it.

##### Share on other sites
What kind of moron wouldn''t have declared them extern first? How dumb do you think I am?
*Looks over his code*
I... umm...
*A muttered, "Thank you", is heard*

• 35
• 12
• 10
• 9
• 9
• ### Forum Statistics

• Total Topics
631355
• Total Posts
2999522
×