Sign in to follow this  
masterGm

pls. help me

Recommended Posts

Who can help me with this error : Linking... CreateDevice.obj : error LNK2001: unresolved external symbol _Direct3DCreate9@4 LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main Debug/CreateDevice.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. CreateDevice.exe - 3 error(s), 0 warning(s) thnks !!!

Share this post


Link to post
Share on other sites
I have a WinMain function It look like this :

---------------------------------------------------------------
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT )
{
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L,
GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
"D3D Tutorial", NULL };
RegisterClassEx( &wc );

HWND hWnd = CreateWindow( "D3D Tutorial", "D3D Tutorial 01: CreateDevice",
WS_OVERLAPPEDWINDOW, 100, 100, 300, 300,
GetDesktopWindow(), NULL, wc.hInstance, NULL );

if( SUCCEEDED( InitD3D( hWnd ) ) )
{
ShowWindow( hWnd, SW_SHOWDEFAULT );
UpdateWindow( hWnd );

MSG msg;
while( GetMessage( &msg, NULL, 0, 0 ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}

UnregisterClass( "D3D Tutorial", wc.hInstance );
return 0;
}
-----------------------------------------------------
I have include the d3d9.lib and after that I still have 2 errors :

LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/CreateDevice.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Share this post


Link to post
Share on other sites
Right. You have a "WinMain" function, but since you created the application as a Win32 console application, it's looking for the "main" function instead. Switch the project configuration over from Win32 Console to Win32, and you should be good to go.

BTW: From now on, when you post, put a more descriptive subject line in. Otherwise, people will be much less likely to read it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this