Sign in to follow this  
assainator

linker problem: LNK 2005

Recommended Posts

heey all, i'm having a problem. if i have 3 files: main.cpp collision.cpp collision.h Object.cpp main.cpp includes: collision.cpp. collision.cpp includes: collision.h Object.cpp includes: collision.h i get the following error:
Quote:
Linking... 1>collision.obj : error LNK2005: "public: void __thiscall CollisionQueue::InsertCollisionEvent(struct P2D,int)" (?InsertCollisionEvent@CollisionQueue@@QAEXUP2D@@H@Z) already defined in main.obj 1>collision.obj : error LNK2005: "public: __thiscall CollisionQueue::CollisionQueue(void)" (??0CollisionQueue@@QAE@XZ) already defined in main.obj 1>C:\Users\Lars\Documents\3dtry\C\Walking_3d\Debug\shooter.exe : fatal error LNK1169: one or more multiply defined symbols found
can somebody help me? i've searched a lot but still haven't found a solution. assainator

Share this post


Link to post
Share on other sites
Whether or not he should use include guards is irrelevant to the problem; they don't prevent multiple definitions over different translation units. Problem is implementation files are pulled into several translation units (probably what's going on when he includes cpp-files), and is not solved by include guards. Properly structuring the project, as described by the article linked, do.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this