Click here to Skip to main content
15,919,479 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi 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
Thanks
Posted

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
C++
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:
http://msdn.microsoft.com/en-us/library/f6xx1b1z(v=vs.100).aspx[^]


Soren Madsen
 
Share this answer
 
Comments
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.
—SA
SajeeshCheviry 2-Jan-13 11:35am    
good answer :-)
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"]

SQL
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)"

D:\vs2010\VC\bin>


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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900