I am trying to make a 3D Engine using OpenGL, I've got all the model loading, 3D nodes, all that stuff done, but I get linker errors when I try to compile, it.. these are the errors:

------ Build started: Project: TheAlienEngine, Configuration: Debug Win32 ------
Compiling...
main.cpp
core.cpp
ae_3d.cpp
Generating Code...
c:\documents and settings\tom\my documents\visual studio 2008\projects\thealienengine\thealienengine\ae_3d.cpp(33) : warning C4700: uninitialized local variable 'model' used
c:\documents and settings\tom\my documents\visual studio 2008\projects\thealienengine\thealienengine\ae_3d.cpp(49) : warning C4700: uninitialized local variable 'node' used
Linking...
core.obj : error LNK2005: "struct options_t somecrazyoptions" (?somecrazyoptions@@3Uoptions_t@@A) already defined in main.obj
core.obj : error LNK2005: "struct node_t * _nodes" (?_nodes@@3PAUnode_t@@A) already defined in main.obj
ae_3d.obj : error LNK2005: "struct node_t * _nodes" (?_nodes@@3PAUnode_t@@A) already defined in main.obj
C:\Documents and Settings\tom\My Documents\Visual Studio 2008\Projects\TheAlienEngine\Debug\TheAlienEngine.exe : fatal error LNK1169: one or more multiply defined symbols found
Build log was saved at "file://c:\Documents and Settings\tom\My Documents\Visual Studio 2008\Projects\TheAlienEngine\TheAlienEngine\Debug\BuildLog.htm"
TheAlienEngine - 4 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I have used include guards in all the header files and I have looked through the pre-processed file and I still couldn't find where those things are defined twice.. I've attached the code in a .zip file if you want to see.

Don't put data definitions in header files. Header guards will only ensure that only one copy exists in each source file in which it is included, but as you see you will get linker errors for multiple definitions. Put data and function definitions in source files.

Move the data definition to a single source file. If you want to allow access to this global data via the header file, extern it in the header.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.