So I've been working on this for the better part of two hours and although I appear to be following the exact instructions of every forum/guide on the internet, I'm still getting linker errors trying to use directX with Visual Studio 2010.
Here is the code I'm starting with:
#include <D3DX10.h>
#include <iostream>
using namespace std;
ostream& operator<<(ostream& os, D3DXVECTOR3& v){
os << "(" << v.x << ", " << v.y << ", " << v.z << ")\n";
return os;
}
int main (){
return 0;
}
I have the SDK downloaded and installed and I have the manually set up the appropriate include and library directories in the project configuration properties. I have also set up additional linker input dependencies:
d3dx10.lib
d3dx10d.lib
However, I am still getting the following errors upon compiling:
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol WinMain@16 referenced in function __tmainCRTStartup
1>C:\Users\Ben\Documents\Visual Studio 2010\Projects\DX Practice\Debug\DX Practice.exe : fatal error LNK1120: 1 unresolved externals
Any and all help is appreciated.
EDIT: Changed int main() to int WinMain(). New errors:
1>c:\users\ben\documents\visual studio 2010\projects\dx practice\dx practice\main.cpp(10): warning C4007: 'WinMain' : must be '__stdcall'
1>c:\users\ben\documents\visual studio 2010\projects\dx practice\dx practice\main.cpp(10): error C2731: 'WinMain' : function cannot be overloaded
1> c:\users\ben\documents\visual studio 2010\projects\dx practice\dx practice\main.cpp(10) : see declaration of 'WinMain'
EDIT2: Figured it out -
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
Thanks all for the help :)
WinMain
was defined the waymain
is. – Nicol BolasWinMain
in first place? Just keep itmain
. Change the linker setting: Linker->System->SubSystem – Ajay