Questions tagged [unresolved-external]

For questions about code that compiles but does not link due to unresolved external symbols. It is important that questions include the full linker command as well as the minimal program that references the name in question.

"Unresolved external symbol" is a linker error. It often means that some function has a declaration, but not a definition.

A common cause of this error is compiling code against a library's headers, but failing to link with that library's code: missing the library from the link command, or picking up a different version of the library.

There is a FAQ: What is an undefined reference/unresolved external symbol error and how do I fix it?. If your question lacks the full linker command, and shows no evidence of having read those answers, do not be surprised if you are redirected there.


How to write a good question

  • Create the simplest reproducible program to demonstrate the issue. A simple way to do this in C is to take the address of the symbol and use it:

    #include <pthread.h>
    
    int main()
    {
        int (*a)(pthread_t) = pthread_detach;
        return !a;
    }
    
  • Show the command used to link the program, and its output:

    gcc -std=c11 -fPIC unresolved-external.c -o unresolved-external
    
    /tmp/user/1432/ccI38tid.o: In function `main':
    unresolved-external.c:5: undefined reference to `pthread_detach'
    collect2: error: ld returned 1 exit status
    
537 questions
0
votes
1 answer

Include Curl in MFC project

I'm fairly new with curl. I need to use curl in c++ with the ssl support. I compiled OpenSSL with nmake and then, and I compiled libcurl as a static library with SLL SUPPORT via the VS10 project. The compilation worked and I tried to build a small…
0
votes
1 answer

VS2010: fatal error LNK1120: 1 unresolved externals . Working with templates

Have a simple assignment with classes and templates for class, have searched on here and no solutions seem to fix the issue. When I try to compile, this comes up: 1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main…
Wade Guest
  • 65
  • 1
  • 1
  • 7
0
votes
1 answer

unresolved external symbol C++ Embedded

I have been stuck a few days now on this issue, and I cannot find an answer to my problem even though google is fuul of replies it seems like this is quite an abstract problematic. Here is my code in H: struct DISPLAYLINE_t { char *text; …
Jmorvan
  • 1,020
  • 11
  • 31
0
votes
3 answers

Why am I getting unresolved externals?

I am writing an immutable binary search tree in c++. My terminating nodes are represented by a singleton empty node. My compiler (visual c++) seems to be having trouble resolving the protected static member that holds my singleton. I get the…
JeffreyABecker
  • 2,724
  • 1
  • 25
  • 36
0
votes
1 answer

Linker can't find function definitions, LNK2001 unresolved external symbol

Here is my simple setup: (i've hidden lots of unneeded information) //AutoFocusTest.h #include "camAVTEx.h" class CAutoFocusTestApp : public CWinApp { protected: camera_t* mCamera; public: virtual BOOL…
xcdemon05
  • 1,372
  • 5
  • 25
  • 49
0
votes
1 answer

Linker 2001 Error and undefined identifier for member variable

Almost done this program, and after moving to a public computer, and changing some code, I noticed that I'm receiving a linker error, and I also decided to ask about another error (and why it's happening). The function in question is below. For some…
Reciever80
  • 105
  • 1
  • 1
  • 10
0
votes
0 answers

linker warning (object specified more than once)

Well I'm once again crashed hard when compiling C++ code using microsoft visual studio. In one of my projects the following error is shown: 1>Debug\xmlreader.obj : warning LNK4042: object specified more than once; extras ignored I have an…
paul23
  • 8,799
  • 12
  • 66
  • 149
0
votes
0 answers

Unresolved token, unresolved external symbol

I'm getting these mistakes shown below. How can I fix them? Transporter.obj : error LNK2028: unresolved token (0A0003E1) "public: __thiscall FTP::FTP(void)" (??0FTP@@$$FQAE@XZ) referenced in function "public: __clrcall…
user2071019
  • 53
  • 1
  • 3
  • 7
0
votes
2 answers

Unresolved external in C-program on Win 32 in Visual Studio 2008

Why doesn't this C-program compile and what does the err messages mean: #include int main() { char op = ' '; char cont = ' '; int tal1 = 0; int tal2 = 0; int result; int ok = 1; printf("Welcome\n"); do { …
Chris_45
  • 8,769
  • 16
  • 62
  • 73
0
votes
1 answer

6 "error LNK2019: unresolved external symbol"

I got 6 unresolved externals. I know what it means but I don't know how to fix it. Collision.cpp #include "Collision.h" void Collision::Collide(Entity &entity1, Entity &entity2) { if(entity1.getX() + entity1.getWidth() > entity2.getX() || …
user1816388
  • 99
  • 1
  • 2
  • 10
0
votes
4 answers

Unresolved external issue c++

trying to use an externally declared class object, but receiving an error. wager.h #ifndef WAGER_H #define WAGER_H #include void won_color_bets(int cardsDealt); class Wager { int bet; int payout; public: bool didBet; …
chuckieDub
  • 1,767
  • 9
  • 27
  • 46
0
votes
1 answer

unresolved external symbol, referenced in function _main

#include #include #include using namespace std; const int numplayers = 10; const int numscores = 3; void playerNames(string[],int); void…
user1743703
  • 133
  • 2
  • 10
0
votes
3 answers

Unresolved External Symbol

I have encountered an error which has stumped me for many days now. A quick google hasn't given me an answer. The code, to my eyes, has no errors however when I run the program I get 9 Unresolved External Symbol(LNK2019) error. After trying to…
ErrorOperator
  • 51
  • 2
  • 8
0
votes
1 answer

OpenCV installation, unresolved external symbols

Possible Duplicate: OpenCV: link error, can’t resolve external symbol _cvResize and _cvCvtColor What is an undefined reference/unresolved external symbol error and how do I fix it? I have tried all of the tutorials available on their website, and…
Bartlomiej Lewandowski
  • 10,771
  • 14
  • 44
  • 75
0
votes
1 answer

Why are my calculations off?

I'm practically done with this program. My only issue is my calculations, I guess. My numbers are completely off. I am too new to post an image, so here is the link to my output. Example:…