pls. help me
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 !!!
Are you linking to the d3d9.lib?
Also, you haven't specified a main() function. Are you using Windows? If so, you either need to create a Console project or set your project to a Win32 exe and make sure you have a WinMain function.
Also, you haven't specified a main() function. Are you using Windows? If so, you either need to create a Console project or set your project to a Win32 exe and make sure you have a WinMain function.
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.
---------------------------------------------------------------
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.
Your error now is that you've created a Windows Console project, whereas you actually should have created a Windows Application. Either change it in your VC project settings or recreate the project as a Win32 application.
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.
BTW: From now on, when you post, put a more descriptive subject line in. Otherwise, people will be much less likely to read it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement