Compiler Error

I get 54 errors when i try to compile my program, I'll post the code and the errors.

main:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "darkGDK.h"

void DarkGDK(void){
	dbSyncOn();
	dbSyncRate(60);
	dbDisableEscapeKey();

	while (LoopGDK()){
		if (dbEscapeKey() == 1){
			break;
		}
		dbSync();
	}
}


block.h/block.cpp:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef BLOCK_H
#define BLOCK_H

#include <string>

using namespace std;

class block{
protected:
	string blocktype;
	virtual int sprite(int x,int y) = 0;
	static string blocktypes[3];
	int id;
};

#endif
#include "block.h"

string block::blocktypes[3] = {"normal,village,dungeon"};


player.h/player.cpp:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef PLAYER_H
#define PLAYER_H

#include <string>
#include "darkGDK.h"
#include "util.h"

using namespace std;

class player{
public:
	player(string name);
	int getVar(int id);
	string getVar(string id);
	void setVar(int id,int value);
	void setVar(string id,string value);
	int sprite(int x,int y);
private:
	string name;
	string weapon;
	string armor;
	int skillpoints;
	int level;
	int gold;
	int exp;
	int damage;
	int exptonextlvl;
};

#endif
#include "player.h"

player::player(string name){
	this->name = name;
	weapon = "knife";
	armor = "rustyplate";
	skillpoints = 0;
	level = 1;
	gold = 0;
	exp = 0;
	damage = 3;
	exptonextlvl = 15;
	dbLoadImage("player.png",util::nextimageid);
	util::nextimageid++;
}
int player::getVar(int id){
	if (id == 1)
		return skillpoints;
	else if (id == 2)
		return level;
	else if (id == 3)
		return gold;
	else if (id == 4)
		return exp;
	else if (id == 5)
		return damage;
	else if (id == 6)
		return exptonextlvl;
	else {
		return -1;
	}
}
string player::getVar(string id){
	if (id == "name")
		return name;
	else if (id == "weapon")
		return weapon;
	else if (id == "armor")
		return armor;
	else {
		return "error";
	}
}
void player::setVar(int id,int value){
	if (id == 1)
		skillpoints = value;
	else if (id == 2)
		level = value;
	else if (id == 3)
		gold = value;
	else if (id == 4)
		exp = value;
	else if (id == 5)
		damage = value;
	else if (id == 6)
		exptonextlvl = value;
}
void player::setVar(string id, string value){
	if (id == "name")
		name = value;
	else if (id == "weapon")
		weapon = value;
	else if (id == "armor")
		armor = value;
}
int player::sprite(int x, int y){
	dbSprite(util::nextspriteid,x,y,util::nextimageid);
	int spriteid = util::nextspriteid;
	util::nextspriteid++;
	return spriteid;
}


util.h/util.cpp:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#ifndef UTIL_H
#define UTIL_H

class util{
public:
	static int nextimageid;
	static int nextspriteid;
};

#endif 
#include "util.h"

int util::nextimageid = 1;
int util::nextspriteid = 1;


normalblock.h/.cpp:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef NORMALBLOCK_H
#define NORMALBLOCK_H

#include "block.h"
#include "darkGDK.h"
#include "util.h"

class normalblock : public block{
public:
	normalblock();
	int sprite(int x,int y);
};

#endif
#include "normalblock.h"

normalblock::normalblock(){
	dbLoadImage("normalblock",util::nextimageid);
	id = util::nextimageid;
	util::nextimageid++;
}
int normalblock::sprite(int x, int y){
	dbSprite(util::nextspriteid,x,y,id);
	int spriteid = util::nextspriteid;
	util::nextspriteid++;
	return spriteid;
}


errors:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
1
1>Compiling...
1>normalblock.cpp
1>Generating Code...
1>Compiling...
1>block.cpp
1>Generating Code...
1>Compiling...
1>player.cpp
1>Generating Code...
1>Linking...
1>display.lib(CGfxC.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>display.lib(CGfxC.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
1>display.lib(CGfxC.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
1>basic3D.lib(DBOFormat.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>basic3D.lib(DBOFormat.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
1>basic3D.lib(DBOFormat.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
1>basic3D.lib(DBOFormat.obj) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator=(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@ABV01@@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
1>basic3D.lib(DBOFormat.obj) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator=(char const *)" (??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
1>basic3D.lib(Universe.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>basic3D.lib(Universe.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
1>basic3D.lib(Universe.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
1>basic3D.lib(cLightMaps.obj) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>basic3D.lib(cLightMaps.obj) : error LNK2005: "public: __thiscall 


I can't post them all but they all look like the ones above
I read both of those and still don't understand how to solve this problem
bump~
This kind of error is often caused by a mismatch of settings. I. e. you compiled your project with multi threading but not the library.
So what should I do?
Anyone?
Look into the settings of each project. Especially 'Character Set' and 'run time libraries' should be the same.

http://www.davidlenihan.com/2008/01/choosing_the_correct_cc_runtim.html


Plus look at the docs of the libraries whether they need special preprocessor definition
Topic archived. No new replies allowed.