Sign in to follow this  

How do I fix a linker error?

This topic is 3592 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, I was making my first Direct X program to display a blue screen. After coding it completely, it complied without any errors. But when I wanted VC++ to build an EXE file for me it threw up an error saying - Linking... C:\PROGRAM FILES\MICROSOFT DIRECTX SDK (AUGUST 2007)\LIB\X64\d3d9.lib : fatal error LNK1113: invalid machine type Error executing link.exe. My EXE file isnt getting created. How do I fix this? Thanks!

Share this post


Link to post
Share on other sites
Ok I changed that to X86 and I got 2 linker errors now...

Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/abhi.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Any ideas?

Share this post


Link to post
Share on other sites
You need to link the library files (there is no comma! between files) d3dxof.lib dxguid.lib d3d9.lib d3dx9.lib winmm.lib into your project. Go to Project/Property Pages/Linker/Input/Additional Dependencies and just type in. In addition, you need to change character set. Go to Project/Property Pages/ Configuration Properties/General/Character Set and make Use Multi-byte Character Set.

Share this post


Link to post
Share on other sites
Well I havent been able able to find the character set option. I use Visual C++ 6.0

I am getting the same error again...

LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/abhi.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

This is so damn irritating. I spend so much of time coding those huge DirectX codes only to end up with this stupid error! URGENT HELP NEEDED for a frustrated programmer! :(

Share this post


Link to post
Share on other sites
Quote:

LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/abhi.exe : fatal error LNK1120: 1 unresolved externals

This means that the linker is looking for a routine to execute (_main, which is main() in C) It has been externally declared, but the linker cannot find its definition.

This is normally defined by the programmer - you. However, in Win32 applications, this entry point is _WinMain instead of _main. - This is where I suspect the problem is at.

Most DirectX programs that I have seen are written for Win32 applications (These use _WinMain) and not Win32 console projects (Default. These use _main), so I second Neverender's suggestion here.

I dont use Visual C++ 6.0, so cannot help you much there.

I do recommend upgrading to a Visual C++ Express Edition (Either 2005 or 2008 version) as Visual C++ 6.0 is both old and not very compilent with C99. Also, Visual C++ 6 has been known to have alot of problems with it.

Also, try to learn more about the linker and linking errors. It will help in understanding the errors and linking problems that you may encounter.

Share this post


Link to post
Share on other sites

This topic is 3592 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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