So... After alot of headaches I figured that this is causing linker errors:
(since code is rather large, I simplified it alot)
1 2
//Somewhere in console.h
inlineint urand(int MIN, int MAX);
...
1 2 3 4 5 6
//Somewhere in console.cpp
//Include guards here
inlineint urand(int MIN, int MAX)
{
return (rand()%(MAX-MIN+1) + MIN);
}
...
1 2 3 4 5 6 7 8
//Somewhere in myClass.cpp
#include "console.h"
myClass::myClass()
{
//Init age
blahblah = urand(0, 4);
}
And the compiler says this:
1>LINK : C:\Documents and Settings\Drago\Desktop\Mislav\Console Learning Project\Console-Learning-Project\Debug\Console Learning Project.exe not found or not built by the last incremental link; performing full link
1>myClass.obj : error LNK2019: unresolved external symbol "int __cdecl urand(int,int)" (?urand@@YAHHH@Z) referenced in function "public: __thiscall myClass::myClass(void)" (??0myClass@@QAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "int __cdecl urand(int,int)" (?urand@@YAHHH@Z)
1>C:\Documents and Settings\Drago\Desktop\Mislav\Console Learning Project\Console-Learning-Project\Debug\Console Learning Project.exe : fatal error LNK1120: 1 unresolved externals
Is there a way to use that inline function I defined in console.h in a constructor of a class?