I have a trouble when linking!!!

Started by
4 comments, last by root1984 18 years, 7 months ago
This is my trouble. I can link with DX's lib when compile. I use C++.NET with DX9.0. plz help me. THANK A LOT. Build Log ------- Build started: Project: Direct3D, Configuration: Debug|Win32 ------- Command Lines Creating temporary file "c:\Documents and Settings\Minh Tuan\My Documents\Visual Studio Projects\RPG with DirectX\Direct3D\Debug\RSP000003.rsp" with contents [ /OUT:"Debug/Direct3D.exe" /INCREMENTAL /NOLOGO /DEBUG /PDB:"Debug/Direct3D.pdb" /SUBSYSTEM:WINDOWS /MACHINE:X86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ".\Debug\MainApp.obj" ] Creating command line "link.exe @"c:\Documents and Settings\Minh Tuan\My Documents\Visual Studio Projects\RPG with DirectX\Direct3D\Debug\RSP000003.rsp"" -------------------------------------- Output Window Linking... MainApp.obj : error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "int __cdecl DoInit(void)" (?DoInit@@YAHXZ) Debug/Direct3D.exe : fatal error LNK1120: 1 unresolved externals -------------------------------------------- Results Build log was saved at "file://c:\Documents and Settings\Minh Tuan\My Documents\Visual Studio Projects\RPG with DirectX\Direct3D\Debug\BuildLog.htm" Direct3D - 2 error(s), 0 warning(s)
Advertisement
There seems to be the inclusion of d3d9.lib missing.

If you're actually including that lib make sure you get the correct lib: Check the default library inclusion paths and make sure the path to the DXSDK lib folder is topmost.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

This...?
But I still have that error T_T.
http://img354.imageshack.us/img354/7486/direct3hf.jpg
No, you have to add it to the linker. You using .NET 2003?

- Rigth click your project name in the solution pane to the left or right or where you have it.
- Choose properties.
- Go to "linker"
- Then go to "Input"
- Then on the line "Additional dependencies" add: "d3d9.lib" and other libs that you are using and havn't added yet like maybe: "d3dx9.lib", "d3dxof.lib", "winmm.lib", "dxguid". Hmm...did I forget anyone now?


- ØØ -
Yes, NoteMe showed the exact way to include libraries. You have to state explicitely which libs you want to include.
Visual Studio does help with the default projects which get the needed libraries included automatically (for example a Win32 project gets user32.lib,gdi.lib and more). It does not however automatically add a lib if you include a certain header.

In Visual Studio you can also add libraries via source code using a pragma:

#pragma comment( lib, "d3d9.lib" )

Note that this pragma is not standard and AFAIK only supported on Visual Studio.


Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

oh yeah! i did. thank u very much!!!

This topic is closed to new replies.

Advertisement