(I am using Visual Studio and have never manually linked object files in to executables)
This is my header code:
#ifndef U_H
#define U_H
typedef unsigned int uint;
typedef unsigned short ushort;
class U{
public:
static uint getX(char* a, uint b, ushort c);
static uint getY(char* a, uint b, ushort c);
static uint getZ(char* a, uint b, ushort c);
};
#endif
and source file:
#include "U.h"
uint U::getX(char* a, uint b, ushort c){
//Stuff
}
uint U::getY(char* a, uint b, ushort c){
//Stuff
}
uint U::getZ(char* a, uint b, ushort c){
//Stuff
}
and in main I #include "U.h"
and then call the above using U::getY(a,b,c)
etc. However I get the following error:
1>main.obj : error LNK2001: unresolved external symbol "unsigned int __cdecl getX(char *,unsigned int,unsigned short)" (?getX@@YAIPEADIG@Z)
1>main.obj : error LNK2001: unresolved external symbol "unsigned int __cdecl getY(char *,unsigned int,unsigned short)" (?getY@@YAIPEADIG@Z)
1>main.obj : error LNK2001: unresolved external symbol "unsigned int __cdecl getZ(char *,unsigned int,unsigned short)" (?getZ@@YAIPEADIG@Z)
I usually forget the U::
part in the source file but this is there??