Hey all!!
So today, i was making the map for my game (tower defense game) and the path so the enemies can follow and something.
Then test time this error appear:
Quote: "1>libcpmtd.lib(xdebug.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Main.obj : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "public: struct Map1 & __thiscall std::vector<struct Map1,class std::allocator<struct Map1> >::operator[](unsigned int)" (??A?$vector@UMap1@@V?$allocator@UMap1@@@std@@@std@@QAEAAUMap1@@I@Z)
1>libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)
1>Release\Oryzhon Engine.exe : fatal error LNK1120: 3 unresolved externals"
First was another one due to some .obj but i fixed up deleting the DX SDK June 2010 from the includes and lib.
But now nothing else is wrong i think... if someone knows the error, please help me out
Here's my full code:
#include "DarkGDK.h"
#include <vector>
using namespace std;
#define WIDTH 1024
#define HEIGHT 768
#define MAX_ENEMIES 100
char Money[256];
char PlayerX[256];
char PlayerY[256];
int GetFreeSpriteID ( void )
{
int id = 0;
while ( dbSpriteExist ( ++id ) );
return id;
}
struct Player
{
void Init();
void Update();
void Buy(int Towerx, int Towery, int Towerprice);
bool buying;
int id;
int x;
int y;
int height;
int width;
int money;
int round;
int score;
};
struct Map1
{
int x;
int y;
};
vector<Map1> Map1V;
struct Enemy1
{
void LoadEnemy(int dificulty);
void Spawn(int SpawnX, int SpawnY, int id);
void Move(int id, int speed, int LastX, int LastY);
void Update(int id, int speed);
void DeleteEnemy(int id);
bool cSpawn;
int image_id;
int speed;
int health;
int id;
int level;
int money;
int score;
};
void PointSprite ( int fromID, int Targetx, int Targety );
void LoadImages ();
void LoadEverything();
void SystemUpdate(Player& player);
void RoundStart(int round, Enemy1&);
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 0 );
dbSetImageColorKey(255, 0, 255);
dbDisableEscapeKey ( );
dbSetDisplayModeAntialias(WIDTH, HEIGHT, 32, 1, 0, 0);
dbSetWindowPosition( 0, 0);
dbSetWindowTitle("GAMENAME - BLABLABLA");
LoadImages();
LoadEverything();
Player player;
player.Init();
Enemy1 enemy1;
enemy1.LoadEnemy(1);
while ( LoopGDK ( ) )
{
dbCLS();
dbPasteImage(1, 0, 0);
//Update
player.Update();
enemy1.Update(enemy1.id, enemy1.speed);
if ( dbEscapeKey ( ) ) break;
SystemUpdate(player);
dbSync ( );
}
return;
}
void PointSprite ( int fromID, int Targetx, int Targety )
{
float ANGLE;
int DX = Targetx - dbSpriteX( fromID );
int DY = Targety - dbSpriteY( fromID );
int DIST = (DX * DX) + (DY * DY);
if( DIST > 0 )
{
ANGLE = dbAtanFull ( Targetx - dbSpriteX( fromID ), dbSpriteY( fromID ) - Targety );
dbRotateSprite( fromID , ANGLE - 180 );
}
}
void LoadImages ()
{
//Background
dbLoadImage("res//Mapa1.png", 1);
//Torres
//Icons
//Other
}
void Enemy1::LoadEnemy(int dificulty)
{
id = GetFreeSpriteID();
image_id = 2;
dbLoadImage("res//enemy1.png", image_id);
level = 1;
speed = -2 * dificulty;
score = 100;
money = 1000;
health = 10;
Map1 points[] = {
{ -100, 160 },
{ 318, 160 },
{ 318, 311 },
{ 560, 311 },
{ 560, 151 },
{ 750, 151 },
{ 750, 677 },
{ 611, 677 },
{ 611, 432 },
{ 112, 432 },
{ 109, 686 },
{ 438, 694 },
{ 438, 800 },
};
for( int i = 0; i < sizeof(points) / sizeof (Map1); i++)
{
Map1V.push_back (points[i]);
}
cSpawn = true;
}
void LoadEverything ()
{
dbPasteImage(1, 0, 0);
}
void SystemUpdate ( Player &player )
{
//Display all Info
sprintf(Money, "Money: %d", player.money);
dbText(10,10,Money);
sprintf(PlayerX, "X: %d", player.x);
dbText(130,10,PlayerX);
sprintf(PlayerY, "Y: %d", player.y);
dbText(190,10,PlayerY);
}
void Player::Init()
{
x = dbMouseX();
y = dbMouseY();
money = 1000;
width = 10;
height = 10;
}
void Player::Update()
{
x = dbMouseX();
y = dbMouseY();
}
void Enemy1::Move(int id, int speed, int LastX, int LastY)
{
PointSprite(id, LastX, LastY);
dbMoveSprite(id, speed);
}
void Enemy1::Update(int id, int speed)
{
if(cSpawn)
{
Spawn(Map1V[0].x, Map1V[0].y, id);
cSpawn = false;
}
if( Map1V.size() > 0 )
{
PointSprite(id, Map1V[0].x, Map1V[0].y);
dbMoveSprite(id, speed);
if(dbSpriteX(id) == Map1V[0].x && dbSpriteY(id) == Map1V[0].y)
{
Map1V.erase (Map1V.begin ());
}
}
else DeleteEnemy(id);
}
void Enemy1::Spawn(int SpawnX, int SpawnY, int Eid)
{
dbSprite(Eid, SpawnX, SpawnY, image_id);
}
void Enemy1::DeleteEnemy(int id)
{
dbDeleteSprite(id);
cSpawn = true;
}
Sorry if it's messy ... ma friends are always saying that i need to put things in groups and in classes but i just feel better this way =D ~
ThaNks a lot
C++ Medium 3.5/5
VB6 Advanced: 4/5
VB.NET Advanced: 4/5