Jump to content
  • Advertisement
Sign in to follow this  
fuzzball

linking program

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

I'm trying to make a wrapper class for the vertex buffer in DirectX. I've created two separate files with the new wrapper class (D3DEngComp.h and D3DEngComp.cpp) and a Vertex structure that contain the x, y, z coordinates of the vertex and a static constant member FVF that is initialized in D3DEngComp.h. When I build the project I receive an linking error regarding FVF. Here are the errors:

Error 1 error LNK2005: "public: static unsigned long const Vertex::FVF" (?FVF@Vertex@@2KB) already defined in cApp.obj D3DEngComp.obj
Error 2 error LNK2005: "public: static unsigned long const Vertex::FVF" (?FVF@Vertex@@2KB) already defined in cApp.obj d3dUtility.obj
Error 3 error LNK2005: "public: static unsigned long const Vertex::FVF" (?FVF@Vertex@@2KB) already defined in cApp.obj graphyx_core.obj
Error 4 error LNK2005: "public: static unsigned long const Vertex::FVF" (?FVF@Vertex@@2KB) already defined in cApp.obj system_core.obj
Error 5 error LNK2005: "public: static unsigned long const Vertex::FVF" (?FVF@Vertex@@2KB) already defined in cApp.obj winmain.obj

I think the problem is related to the way D3DEngComp.h header file is included in other files but I can't find a solution to this problem that will keep the wrapper class in the two files I've made.
I've uploaded the project to this link if anyone is interested about helping me:

http://rapidshare.com/files/408260449/Colored_Quad_2.rar

LE: by the way, the title of the thread should be "linking problem", not "linking program". I was in a hurry when I've made the thread and when I noticed the mistake it was to late. Sorry for the mistake!

Share this post


Link to post
Share on other sites
Advertisement
It sounds like you put the definition of Vertex::FVF in the header when it should be in the source file.

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!