Thread: Installing Direct X

  1. #16
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    1>------ Build started: Project: Direct_X, Configuration: Debug Win32 ------
    1>Compiling...
    1>winmain.cpp
    1>c:\dxsdk\include\d3d9.h(33) : fatal error C1083: Cannot open include file: 'objbase.h': No such file or directory
    1>Build log was saved at "file://c:\Documents and Settings\Mike The Magnificant\My Documents\Visual Studio 2005\Projects\Direct_X\Direct_X\Debug\BuildLog.htm "
    1>Direct_X - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    That is what I get, although do I need the \x86 if I am using 9.0b? There is certainly no folder called \x86.

    Maybe I haven't added them right, I jsut put C:\DXSDK\Include into the include directories and C:\DXSDK\Lib\x86 into the library directories.

  2. #17
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    There is certainly no folder called \x86
    If it's not there in your version then don't use it - everything I have written thus far in this thread refers to the aug2006 dx sdk. It seems there's a newer version of the dx sdk just released: Oct 2006
    Quote Originally Posted by bumfluff
    Cannot open include file: 'objbase.h': No such file or directory
    objbase.h is in the platform sdk so I can only assume you didn't install it or configure msvc-express to use that first. Follow these instructions: Using Visual C++ 2005 Express Edition with the Microsoft Platform to do that.

    If you're having to do that anyway, you'd probably be better just uninstalling the version of the directx sdk you currently have, installing and configuring the psdk as described in the 'Using Visual C++ 2005 Express Edition with the Microsoft Platform' link above, downloading the oct 2006 directx sdk and installing that. The oct 2006 directx sdk installer should offer to configure msvc-express to use it but, if it doesn't, just follow the manual procedure already described.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #18
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Will, this use exactly the same source code as my book which is written using 9.0b? I know there were changes from 9.0 to 9.0b, what about now?

  4. #19
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Have you solved the error with objbase.h yet? If not, you'll need to install the psdk and/or configure msvc-express to use it as I stated previously; there's really no point in discussing potential differences in various versions of directx because that particular error has nothing whatsoever to do with directx.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  5. #20
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Ok, I have done the Platform SDK and none of the errors now seem to be with the Direct X:

    1>c:\documents and settings\mike the magnificant\my documents\visual studio 2005\projects\direct_x\winmain.cpp(56) : error C2440: '=' : cannot convert from 'const char [18]' to 'LPCWSTR'
    1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    1>c:\documents and settings\mike the magnificant\my documents\visual studio 2005\projects\direct_x\winmain.cpp(92) : error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [18]' to 'LPCWSTR'
    1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    1>c:\documents and settings\mike the magnificant\my documents\visual studio 2005\projects\direct_x\winmain.cpp(116) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [25]' to 'LPCWSTR'
    1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    1>c:\documents and settings\mike the magnificant\my documents\visual studio 2005\projects\direct_x\winmain.cpp(129) : warning C4244: 'return' : conversion from 'WPARAM' to 'int', possible loss of data
    1>c:\documents and settings\mike the magnificant\my documents\visual studio 2005\projects\direct_x\winmain.cpp(136) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [26]' to 'LPCWSTR'
    1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    1>c:\documents and settings\mike the magnificant\my documents\visual studio 2005\projects\direct_x\winmain.cpp(142) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [28]' to 'LPCWSTR'
    1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    1>c:\documents and settings\mike the magnificant\my documents\visual studio 2005\projects\direct_x\winmain.cpp(164) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [31]' to 'LPCWSTR'
    1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    1>c:\documents and settings\mike the magnificant\my documents\visual studio 2005\projects\direct_x\winmain.cpp(169) : warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
    1>c:\documents and settings\mike the magnificant\my documents\visual studio 2005\projects\direct_x\winmain.cpp(201) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [24]' to 'LPCWSTR'
    1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    1>Build log was saved at "file://c:\Documents and Settings\Mike The Magnificant\My Documents\Visual Studio 2005\Projects\Direct_X\Direct_X\Debug\BuildLog.htm "
    1>Direct_X - 7 error(s), 2 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    Perhaps it is because the window code is written in C?

  6. #21
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    No, your code doesn't use unicode and msvc-express does by default. Rather than fight with that aspect, too, it would be simpler if you just disable unicode for your msvc-express project:

    project menu --> 'your_project name properties', select 'configuration properties' and set 'character set' to 'use multi-byte character set'.

    Don't forget to do that for each configuration (debug, release).
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  7. #22
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    1>------ Build started: Project: Direct_X, Configuration: Debug Win32 ------
    1>Linking...
    1>winmain.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcA@16 referenced in function "long __stdcall WinProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WinProc@@YGJPAUHWND__@@IIJ@Z)
    1>winmain.obj : error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall WinProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WinProc@@YGJPAUHWND__@@IIJ@Z)
    1>winmain.obj : error LNK2019: unresolved external symbol __imp__RegisterClassExA@4 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" (?MyRegisterClass@@YAGPAUHINSTANCE__@@@Z)
    1>winmain.obj : error LNK2019: unresolved external symbol __imp__GetStockObject@4 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" (?MyRegisterClass@@YAGPAUHINSTANCE__@@@Z)
    1>winmain.obj : error LNK2019: unresolved external symbol __imp__LoadCursorA@8 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" (?MyRegisterClass@@YAGPAUHINSTANCE__@@@Z)
    1>winmain.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageA@4 referenced in function _WinMain@16
    1>winmain.obj : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function _WinMain@16
    1>winmain.obj : error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function _WinMain@16
    1>winmain.obj : error LNK2019: unresolved external symbol __imp__PeekMessageA@20 referenced in function _WinMain@16
    1>winmain.obj : error LNK2019: unresolved external symbol __imp__UpdateWindow@4 referenced in function _WinMain@16
    1>winmain.obj : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function _WinMain@16
    1>winmain.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function _WinMain@16
    1>winmain.obj : error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "int __cdecl Game_Init(struct HWND__ *)" (?Game_Init@@YAHPAUHWND__@@@Z)
    1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
    1>C:\Documents and Settings\Mike The Magnificant\My Documents\Visual Studio 2005\Projects\Direct_X\Debug\Direct_X.exe : fatal error LNK1120: 14 unresolved externals
    1>Build log was saved at "file://c:\Documents and Settings\Mike The Magnificant\My Documents\Visual Studio 2005\Projects\Direct_X\Direct_X\Debug\BuildLog.htm "
    1>Direct_X - 15 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    That is what I get now. This is so much mroe complicated than I thought it would be.

  8. #23
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    499
    You're not linking with the Win32 libraries, otherwise you wouldn't get the unresolved symbols about the MessageBox and all that other crap.

    When you create your project, make sure you choose "Win32" as the type, and you shouldn't have any problems.

  9. #24
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Quote Originally Posted by bumfluff
    That is what I get now. This is so much mroe complicated than I thought it would be.
    As joeprogrammer has pointed out you need to create a win32 project which, with msvc-express properly configured to use the psdk, is described in 'Using Visual C++ 2005 Express Edition with the Microsoft Platform' instructions I previously linked to as:
    Quote Originally Posted by Using Visual C++ 2005 Express Edition with the Microsoft Platform
    From the File menu, click New Project. In the New Project dialog box, expand the Visual C++ node in the Product Types tree and then click Win32. Click on the Win32 Console Application template and then give your project a name and click OK. In the Win32 Application Wizard dialog box, make sure that Windows application is selected as the Application type and the ATL is not selected. Click the Finish button to generate the project.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  10. #25
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Windows Application seems to be blanked out in the Win32 Application Wizard Dialog Box.

  11. #26
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Did you do step 5?
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  12. #27
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageA@4 referenced in function _WinMain@16
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function _WinMain@16
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__TranslateAcceleratorA@12 referenced in function _WinMain@16
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__GetMessageA@16 referenced in function _WinMain@16
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__LoadAcceleratorsA@8 referenced in function _WinMain@16
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__LoadStringA@16 referenced in function _WinMain@16
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__RegisterClassExA@4 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" (?MyRegisterClass@@YAGPAUHINSTANCE__@@@Z)
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__LoadCursorA@8 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" (?MyRegisterClass@@YAGPAUHINSTANCE__@@@Z)
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__LoadIconA@8 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" (?MyRegisterClass@@YAGPAUHINSTANCE__@@@Z)
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__UpdateWindow@4 referenced in function "int __cdecl InitInstance(struct HINSTANCE__ *,int)" (?InitInstance@@YAHPAUHINSTANCE__@@H@Z)
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function "int __cdecl InitInstance(struct HINSTANCE__ *,int)" (?InitInstance@@YAHPAUHINSTANCE__@@H@Z)
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function "int __cdecl InitInstance(struct HINSTANCE__ *,int)" (?InitInstance@@YAHPAUHINSTANCE__@@H@Z)
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__EndPaint@8 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__BeginPaint@8 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcA@16 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__DestroyWindow@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__DialogBoxParamA@20 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
    1>GonnaWork.obj : error LNK2019: unresolved external symbol __imp__EndDialog@8 referenced in function "int __stdcall About(struct HWND__ *,unsigned int,unsigned int,long)" (?About@@YGHPAUHWND__@@IIJ@Z)
    1>C:\Documents and Settings\Mike The Magnificant\My Documents\Visual Studio 2005\Projects\GonnaWork\Debug\GonnaWork.exe : fatal error LNK1120: 19 unresolved externals
    1>Build log was saved at "file://c:\Documents and Settings\Mike The Magnificant\My Documents\Visual Studio 2005\Projects\GonnaWork\GonnaWork\Debug\BuildLog.h tm"
    1>GonnaWork - 20 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    Ok, I now get that when compiling the standard code for a window that it gives me when I create a new windows application. I think it is something to do with linking but I am not up on compiler settings as you already know.

  13. #28
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    You're not linking against user32.lib. It ought to link against it by default, so either the import library is not installed or you have "Ignore default libraries" enabled. Try listing user32.lib explicitely in the import libraries field of the linker input configuration.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  14. #29
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Right I realised what I had done wrong, I had tried to change the wrong corewin file... I had changed Core_win (which was already correct) rather than Core_Win Express.

    How do I run the program with VC++?

  15. #30
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Forget that last question.

    1>GonnaWork.obj : error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "int __cdecl Game_Init(struct HWND__ *)" (?Game_Init@@YAHPAUHWND__@@@Z)
    1>C:\Documents and Settings\Mike The Magnificant\My Documents\Visual Studio 2005\Projects\GonnaWork\Debug\GonnaWork.exe : fatal error LNK1120: 1 unresolved externals
    1>Build log was saved at "file://c:\Documents and Settings\Mike The Magnificant\My Documents\Visual Studio 2005\Projects\GonnaWork\GonnaWork\Debug\BuildLog.h tm"
    1>GonnaWork - 2 error(s), 2 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    Problems linking to Direct X?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Direct Input shutting down improperly
    By Deo in forum Game Programming
    Replies: 3
    Last Post: 06-14-2005, 06:54 AM
  2. Direct x 8 include files
    By Zoalord in forum Game Programming
    Replies: 2
    Last Post: 03-17-2004, 04:07 PM
  3. Direct X
    By MicroFiend in forum C++ Programming
    Replies: 2
    Last Post: 03-21-2003, 02:34 PM
  4. Direct Music Illegal Static Member Call error
    By FwyWice in forum Game Programming
    Replies: 4
    Last Post: 11-30-2002, 05:14 PM
  5. Direct Music Trouble
    By FwyWice in forum Game Programming
    Replies: 5
    Last Post: 11-29-2002, 04:01 PM