Questions tagged [undefined-reference]

A linker error caused by a missing definition of a symbol used elsewhere in a program

The most common causes are

  • Declaring but not defining a function, global variable or static data member
  • Not compiling or linking to an object file that contains the definition of a symbol
  • Forgetting to link to the library that provides the symbol
  • Listing a required library before the objects that depend on it (in the linker command libraries should be listed after the objects that depend on them)

There is a C++ FAQ question about undefined references in C++ and how to solve them.

1243 questions
-2
votes
0 answers

Linker error undefined reference to class function not mentioned in source or header

I am attempting to compile a shared library for Linux, using CMake under Yocto. The makefile specifies that it builds some .o objects then links them into a shared library .so. Some source files are C++, some are C. Maybe I should note that I do…
Jason
  • 5
  • 1
  • 6
-2
votes
0 answers

undefined cudaMalloc on the jetson

The equipment is shown in the figure Behind is my c++ code #include "opencv2/core.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/imgcodecs.hpp" #include "opencv2/highgui.hpp" #include #include…
grandlee
  • 13
  • 1
-2
votes
1 answer

C++ undefined reference to `findGrossPay(employeeInfo, double, int)'

A class I've been working on for a few days, running into an error I'm unsure how to fix. #include // for cin, cout, endl #include #include // formatting floats using namespace std; void…
Rachel
  • 11
  • 1
-2
votes
1 answer

Undefined reference to vtable when functions are defined in VS Code

I've seen a lot of questions about this, but can't seem to see what I'm missing. I am fairly new at C++. I am using Visual Studio Code with G++ and MINGW32 10.3.0. When I attempt to run test.cpp (below) I receive two errors: ...test.cpp:7: undefined…
-2
votes
1 answer

Visual Studio Code with SDL library, can't build. Undefined reference problem

I want to work with Simple DirectMedia Layer using Visual Studio Code for development. I followed these excellent instructions to set up Visual Studio Code for gcc. https://code.visualstudio.com/docs/cpp/config-linux. I use Mint 20.2. I quickly…
Keith
  • 49
  • 5
-2
votes
1 answer

Getting undefined reference to a properly defined friend function -_-

So... I was happily working on a project and then I was going to implement a friend function, which returns an object of the class after generating a random number of arbitrary size. On compilation, it's showing the error undefined reference... blah…
-2
votes
1 answer

Fish game "NameError" . 'shark' is not defined?

I'm doing a game on pygame and i'm facing a problem and i'm trying to figure out the problem i'm facing. and i dont know the solution. I'm getting following error msg: I'm getting following error msg: …
-2
votes
1 answer

Movesense With nRF5_SDK : undefined reference to `__locale_ctype_ptr'

I am in my first compilation using the accelerometer_app example. Ninja crashes in step 1. It seems to be due to a problem with the linking process. Here is the output. PS…
Pierre Lepage
  • 368
  • 2
  • 8
-2
votes
1 answer

Prolog tells me a procedure is undefined when it appears to be defined

I'm new to Prolog and I'm having trouble figuring out why it's telling me procedures are undefined when I query them, when they appear to be defined. This code was given to me by my instructor and I'm not allowed to change it, so it must be a…
jipthechip
  • 157
  • 1
  • 13
-2
votes
1 answer

"Undefined reference" errors when including

I have started a new console application (C++) in Code::Blocks 17.12 with Cygwin compiler and g++ 7.3.0, and I have only "main.cpp" which have a very small code: #include using namespace std; int main(){ cout<<"test"; return 0; } I…
-2
votes
1 answer

How to resolve the undefined reference error to readimagefile in dev C++

I am getting an error in Dev C++ with the function readimagefile. It says 'undefined reference to readimagefile' whenever I try to use the function included in the header file 'graphics.h'. Here is my code to show an image: int main() { …
-2
votes
1 answer

JQuery selector works perfect, except with Safari

I want to fetch an URL-Attribute from a div and my code works perfectly find, except on Safari, where this line: var url = $('.image').css('background-image').split('url("')[1].split('")')[0]; throws an Error, because the .split-function cannot be…
mfaorlkzus
  • 149
  • 3
  • 14
-2
votes
1 answer

Getting undefined reference errors in c compiling via gcc

Already fixed it thx I got 5 files: cdouble.c cdouble.h cmatrix.c cmatrix.h and main.c in my cdouble.c I have: #include "cdouble.h" in my cmatrix.c I have: #include "cmatrix.h" (in my cmatrix.h file i got: #include "cdouble.h" And in my main file…
alex403
  • 15
  • 1
  • 3
-2
votes
1 answer

Installing ZeroMQ in Ubuntu 16.04 64 bits

I'm trying to install zeromq but I'm having some problems with undefined reference . I used this tutorial to install zeromq in my machine, with the difference that I downloaded version 4.1.4 and not 4.1.2. Then I'm trying to run the following…
CoolTarka
  • 103
  • 1
  • 8
-2
votes
1 answer

Different errors compiling C using Codeblocks

I want to compile a file using Codeblocks. This main file calls other C files. When I build and run it, I have several errors in my console. First, I have this error: ===Build file: "no target" in "no project" (compiler unknown) ===. I think that…
PNB
  • 75
  • 10