Click here to Skip to main content
13,004,203 members (75,899 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I get this some time. but i can't understand what it say

Error 3 error LNK1120: 1 unresolved externals C:\Users\mohammadali1375\documents\visual studio 2010\Projects\MyEngine\MEngine\Debug\MEngine.exe

Error 2 error LNK2001: unresolved external symbol "public: virtual void __thiscall MEngineComponent::Update(void)" (?Update@MEngineComponent@@UAEXXZ) C:\Users\mohammadali1375\documents\visual studio 2010\Projects\MyEngine\MEngine\MEngine\TestComponent.obj

I want to know when does it happen
Posted 29-Dec-12 7:25am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

A couple of things can cause this. You might not have linked correctly to the library file you are trying to use.

Another possibility is that you have declared the function
void Update(void)
in the header file for you MEngineComponent class, but you forgot to actually code the function in the .cpp file. I actually think this would give you the LNK2019 error, but you should double-check to make sure.

If that is not your problem, take a look here for other causes:[^]

Soren Madsen
Espen Harlinn 29-Dec-12 16:40pm
That's a reasonable explanation :-D
SoMad 29-Dec-12 17:13pm
Thanks, I am a reasonable man :-). In the article I linked to, there are actually more causes than I expected (and have encountered myself).

Soren Madsen
Sergey Alexandrovich Kryukov 29-Dec-12 21:47pm
Explained, a 5.
SajeeshCheviry 2-Jan-13 11:35am
good answer :-)
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

A very useful tool that you can use to figure out the exact API that is missing is called 'undname.exe' which is in the \VC\bin directory of your Visual Studio installation (for example, "D:\vs2010\VC\bin\undname.exe" for my VS2010 installation). You can use it to undecorate a name that is generated by the compiler. Here is a sequence that tells you more about the missing API:

[Note that the name flagged in your message above is "?Update@MEngineComponent@@UAEXXZ"]

D:\whatever>cd \vs2010\VC\bin
D:\vs2010\VC\bin>undname ?Update@MEngineComponent@@UAEXXZ
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.
Undecoration of :- "?Update@MEngineComponent@@UAEXXZ"
is :- "public: virtual void __thiscall MEngineComponent::Update(void)"

The cause of the error can be a result of a declaration in a header file that is not implemented, differing parameter list between declaration and definition, mixed definition of linkage (ie. __thiscall, __stdcall etc.), missing export details ("__declspec(dllexport)") or several other things.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170627.1 | Last Updated 1 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100