I am getting this error from the linker:
Compiler Output Version:
------ Build started: Project: Dark GDK - Test Game, Configuration: Debug Win32 ------
Compiling...
gclass.cpp
Main.cpp
Generating Code...
Linking...
Main.obj : error LNK2019: unresolved external symbol "public: __thiscall _Point2d<float>::_Point2d<float>(float,float)" (??0?$_Point2d@M@@QAE@MM@Z) referenced in function "void __cdecl DarkGDK(void)" (?DarkGDK@@YAXXZ)
Debug\Dark GDK - Test Game.exe : fatal error LNK1120: 1 unresolved externals
Build log was saved at "file://c:\Documents and Settings\tom\My Documents\Visual Studio 2008\Projects\Project1\Project1\Dark GDK - Test Game\Dark GDK - Test Game\Debug\BuildLog.htm"
Dark GDK - Test Game - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Error List Version:
Error 1 error LNK2019: unresolved external symbol "public: __thiscall _Point2d<float>::_Point2d<float>(float,float)" (??0?$_Point2d@M@@QAE@MM@Z) referenced in function "void __cdecl DarkGDK(void)" (?DarkGDK@@YAXXZ) Main.obj
Error 2 fatal error LNK1120: 1 unresolved externals c:\Documents and Settings\tom\My Documents\Visual Studio 2008\Projects\Project1\Project1\Dark GDK - Test Game\Dark GDK - Test Game\Debug\Dark GDK - Test Game.exe 1
Here is where I define _Point2d:
gclass.h:
#pragma once
#include "DarkGDK.h"
template<typename T>
struct _Point3d{
T x, y, z;
_Point3d():x(0),y(0),z(0){}
_Point3d(T xx, T yy, T zz);
bool operator==(_Point3d<T> a)
{return(a.x==x && a.y==y);}
bool operator!=(_Point3d<T> a)
{return!(a.x==x && a.y==y);}
_Point3d<T> operator+=(_Point3d<T> a)
{return _Point3d<T>(a.x+x, a.y+y);}
_Point3d<T> operator-=(_Point3d<T> a)
{return _Point3d<T>(a.x-x, a.y-y);}
_Point3d<T> operator+(_Point3d<T> a)
{return _Point3d<T>(a.x+x, a.y+y);}
_Point3d<T> operator-(_Point3d<T> a)
{return _Point3d<T>(a.x-x, a.y-y);}
};
template<typename T>
struct _Point2d{
T x, y;
_Point2d():x(0),y(0){}
_Point2d(T xx, T yy);
bool operator==(_Point2d<T> a)
{return(a.x==x && a.y==y);}
bool operator!=(_Point2d<T> a)
{return!(a.x==x && a.y==y);}
_Point2d<T> operator+=(_Point2d<T> a)
{return _Point2d<T>(a.x+x, a.y+y);}
_Point2d<T> operator-=(_Point2d<T> a)
{return _Point2d<T>(a.x-x, a.y-y);}
_Point2d<T> operator+(_Point2d<T> a)
{return _Point2d<T>(a.x+x, a.y+y);}
_Point2d<T> operator-(_Point2d<T> a)
{return _Point2d<T>(a.x-x, a.y-y);}
};
typedef _Point2d<int> point2di;
typedef _Point3d<int> point3di;
typedef _Point3d<float> point3df;
typedef _Point2d<float> point2df;
gclass.cpp:
#include "gclass.h"
template<typename T>
_Point3d<T>::_Point3d(T xx, T yy, T zz)
:x(xx), y(yy), z(zz)
{
}
template<typename T>
_Point2d<T>::_Point2d(T xx, T yy)
:x(xx), y(yy)
{
}
And this is where I use it:
Main.cpp:
#include "DarkGDK.h"
#include "gclass.h"
void DarkGDK(void)
{
dbSyncOn();
dbSyncRate(60);
char* text;
point2di p(1,1);
point2di p2(1,1);
text = dbStr(p.x);
dbText(0,0,text);
text = dbStr(p.y);
dbText(8,8,text);
p += p2;
text = dbStr(p.x);
dbText(16,16,text);
text = dbStr(p.y);
dbText(24,24,text);
p -= p2;
text = dbStr(p.x);
dbText(32,32,text);
text = dbStr(p.y);
dbText(40,40,text);
while(LoopGDK()){
dbSync();
}
delete text;
return;
}
And I have no idea about linker errors like this, I looked up the error code on the MSDN website, but that provided no help as I can see no place where I refrenced a symbol that I havn't defined..
And help would be appreciated
#ifdef __NEWBIE__
MakeAnAwesomeGame(lots of badies, lots of guns, lots of stuff to do, BIG level)
#endif