Focus on 2D in Direct3D/VS.NET ?

Started by
3 comments, last by progrmr 20 years, 11 months ago
I''ve just purchased the book Focus on 2D in Direct3D and am trying to build the first example in VS.NET. I got the project created correctly - New Project -> Win32 Project ->Application Settings -> Console Application; Blank project. I added the main.cpp file - my include and lib directories are correctly setup. But I''m getting a strange linker error. Now I''m NOT a VC++ pro - but I''ve never seen anything like this. Check this out (from the build window):
  
Linking...
main.obj : error LNK2019: unresolved external symbol _Direct3DCreate8@4 referenced in function "void __cdecl Prog_Init(void)" (?Prog_Init@@YAXXZ)
LIBCD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
Debug/Test2.exe : fatal error LNK1120: 2 unresolved externals
  
Is there some linker setting that I''ve missed? After dropping $100 on game dev books this week the last thing I want to do is spend more on a VC++.NET book! Any ideas? ------------------------ Don''''t follow me - I''''m lost!
------------------------Don''t follow me - I''m lost!
Advertisement
I think this is where it''s blowing up:

void Prog_Init ( )
{
//create the IDirect3D8 object
g_pd3d = Direct3DCreate8 ( D3D_SDK_VERSION ) ;

I added the lib directories for the SDK to the project, but it didn''t make any difference and I already have them setup in the IDE settings anyway.

------------------------
Don''''t follow me - I''''m lost!
------------------------Don''t follow me - I''m lost!
1. You''ve got a Console app there by the looks of it. Find WinMain change it to main( int argc, char **argv ). You''ll notice an ugly console window when you run your program - if you want it to go away, create a new project - make sure it''s a Win32 application, not a console application - and put all your crap from the old project into the new one. Rename main back to WinMain.

2. Despite what you said, I''m not entirely sure you''re linking correctly. You''ll most likely want to link with d3d8.lib and d3dx8.lib.

Take it easy,

Tom L
refrain_from_stupidity( &me );
quote:Original post by krumms
1. You''ve got a Console app there by the looks of it. Find WinMain change it to main( int argc, char **argv ). You''ll notice an ugly console window when you run your program - if you want it to go away, create a new project - make sure it''s a Win32 application, not a console application - and put all your crap from the old project into the new one. Rename main back to WinMain.

2. Despite what you said, I''m not entirely sure you''re linking correctly. You''ll most likely want to link with d3d8.lib and d3dx8.lib.

Take it easy,

Tom L


Thanks for the reply.

1) I''ll try this - I should''ve noticed the WinMain function and not main **duh!**

2) Do I just add the d3d8.lib and d3dx8.lib to the ''Additional Dependencies'' in the project linker settings?

Thanks again!

------------------------
Don''''t follow me - I''''m lost!
------------------------Don''t follow me - I''m lost!
Ha! That worked

I just added the 2 .lib files to the project linker dependencies and it compiled.

Got some smart folks up in here

------------------------
Don''''t follow me - I''''m lost!
------------------------Don''t follow me - I''m lost!

This topic is closed to new replies.

Advertisement