# Microsoft Visual Studio .NET Release Build

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

## Recommended Posts

Hello, I just got my student version of the aforementioned program in the mail the other day and I decided to write a quick tron clone to play around with it. Before now all I've ever used were some of the various linux IDEs, and I can already say I absolutly love it. Anyway, I wrote my tron clone and everything worked wonderfully when I compiled it in debug mode. Then I wanted to switch it over to a Release build to see what the difference was. Now everytime I try to build I get "error LNK2005 blah blah player::crash(void) (?crash@player@@QAEXXZ)) already defined in player .obj." I tried to delete all of the .obj files (also tried the Clean Solution option) and rebuild, but it gets the same error again. I tried looking around in google for a bit but I couldn't find anything. Anyone here able to shine some light on the situtation. Thanks for your time.

##### Share on other sites
> first things first - check yor build log, see what the linker is linking.
> from the description of the error it is trying to define something in two obj files, find out which ones (the obj files are directly generated from your cpp files) and stop both from being linked, (check your code for duplicates of the class)

##### Share on other sites
Well that's weird. I checked the buildlog and it seemed that everything was in order (it did work in debug mode after all). So I thought about it for a bit and decided to try copying everything from my player.cpp to my player.h file. This fixed it.

I've never had any problems like this when programming in linux. I've heard that MVS .NET doesn't follow the C++ standards. Is there a certain way you're supposed to set up classes in MVS .NET

here's a glimpse of how I did it
in player.h:class player{public:    int getTrivialData() {return data;}    void bigUglyFunction();private:    int data;};in player.cpp:#include "player.h"void player::bigUglyFunction(){    // code}

Is this wrong?

##### Share on other sites
You did have include guards in the .h file, right?
ie
//player.h#ifndef PLAYER_H#define PLAYER_Hclass player{public:    int getTrivialData() {return data;}    void bigUglyFunction();private:    int data;};#endif

##### Share on other sites
Yes, I just forgot to put them in my example. Sorry about that.

Though, now I'm more confused. I just opened up a new solution and did the same thing as I orinigally had and it worked right off the bat. I'll have to go through all of the settings later and see if I changed anything. I did go through all of the settings and changed a bunch of stuff when I first started, I probably forgot to change something back. Probably not a good idea to start programming in the same project and expect everything to work as usual =)

Thanks for your time. I'll let you know later tonight if I find what I changed.

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
16
5. 5

• 14
• 29
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631774
• Total Posts
3002274
×