Sign in to follow this  
root1984

I have a trouble when linking!!!

Recommended Posts

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)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?


- ØØ -

Share this post


Link to post
Share on other sites
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.


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