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
0
votes
1 answer

Cygwin OpenGL compiling returns undefined references to imp_iob

I'm attempting to compile this tutorial http://www.opengl-tutorial.org/beginners-tutorials/tutorial-1-opening-a-window/ with Cygwin. I'm getting the following errors: $ g++ main.cpp -o main -lm -lgl -lglut -lglew -lglfw -lopengl32 -lglu32 -lglaux …
Amanita
  • 11
  • 3
0
votes
1 answer

Setting the timeout when using Dojo

I recently updated an app that uses Dojo to sent asynchronous petitions to my server which serves these petitions with cgi. My problem is as follows. So for example the variable that makes the requests…
richardtk_1
  • 751
  • 3
  • 11
  • 33
0
votes
1 answer

How was this function signature inferred?

The compiler error I'm getting from g++ is ./Debug_gcc_lin64_5610_ST/tom.o: In function `process_P2T_CUST(IPC*)': /mxhome/charrison/git/libs/tom.cpp:512: undefined reference to `memorize_block(boost::unordered_map< ... >&, Block const&)' (Ellipsis…
Chap
  • 3,649
  • 2
  • 46
  • 84
0
votes
0 answers

C++ Undefined Reference error between files

I was coding a simple text based RPG when I came across this error. I use the Code::Blocks IDE, so it should compile it all for me. I'm new to C++ so I couldn't make sense out of all the rather advanced codes getting this same error. Here's the…
LemenDrop
  • 160
  • 1
  • 3
  • 11
0
votes
1 answer

Undefined reference error, even after specifying -L and -l flags

I am trying to compile this package and keep getting an undefined reference to error. I copied and edited the final compiler code in the makefile to make sure the external libraries needed are called before the other libraries. Here's the…
xcorat
  • 1,434
  • 2
  • 17
  • 34
0
votes
2 answers

Undefined reference to class_namefunction_name(variable)?

I'm getting a fatal linking error in the code below, it says: ]+0x10)||undefined reference to `base::pass_derived(node)'| I wanted to define a base class which has a pointer called poly_type and the base class can also "access" from within…
pandoragami
  • 5,387
  • 15
  • 68
  • 116
0
votes
1 answer

Not able to link to compiled /.so source libraries in C++

I am new to C++. I am trying to use the MySQL replication in a C++ program to read the binlogs from MySQL. I got the header files and .cpp source files from Internet. Now I've placed the header files in /usr/include/mysql folder and set the path of…
Ajim Bagwan
  • 127
  • 3
  • 10
0
votes
1 answer

undefined reference to ... in a nested class trying to declare an array?

I'm trying to initialize an array called ARRAY inside the constructor of a class called CLASS_A and this array is supposed to be accessible by the nested class CLASS_B. I thought of making the array a template but that was when things started to get…
pandoragami
  • 5,387
  • 15
  • 68
  • 116
0
votes
2 answers

Undefined reference to class constructor

Here's my code: menuState.hpp #ifndef MENU_STATE_HPP #define MENU_STATE_HPP #include "state.hpp" #include class MenuState : public State { public: MenuState(); static void create(StateListener* Parent,…
user768417
0
votes
0 answers

Error while compiling a simple project

I am trying to compile a project in CodeBlocks (12.11) with wxWidgets 64 bit (2.8.12) and I am getting this errors: undefined reference to `__imp_z22wxInitAllImageHandlersv'| undefined reference to…
0
votes
2 answers

undefined reference to function, when using if defined on Windows (on Linux its ok)

I have a strange problem. I have those files: lib.h: #ifndef _LIB_H_ #define _LIB_H_ double fun(int a); #endif lib.c: #include "lib.h" #include #if !defined(MY_FUN) && ((defined(__MINGW32__) || defined(__MINGW64__)) &&…
yak
  • 3,770
  • 19
  • 60
  • 111
0
votes
2 answers

ReferenceError: function parseXml undefined in Firefox

I am getting this strange error even when parseXml is defined. The piece of code works fine in Chrome but NOT in Firefox. $(document).on("pageinit", "#map-page", function () { var defaultLatLng = new google.maps.LatLng(56.8517843,…
SASM
  • 1,292
  • 1
  • 22
  • 44
0
votes
1 answer

Linking dll to c++ in qt for reading .mat files

I am using Qt Creator 2.4.1(Based on Qt 4.7.4) .. Now I want to open the .mat file which I got from Matlab. I am using the basic function matOpen Initially, I knew the headers required. They are mat.h, matrix.h and tmw.h. Now, before running the…
Sarat
  • 1
  • 1
0
votes
1 answer

undefined reference to a library function but same message doesn't appear in other computers

I have written a QT application that consists of three projects: Lib, RT, Gui. Lib has been created as shared library and it is used by RT and Gui. I have create an svn repository where I commit all the changes. With my first computer there are no…
draniris
  • 71
  • 1
  • 6
0
votes
2 answers

undefined reference to function after changing function declaration

I have a file bridge.h, which contains a function declaration: int getDisplayPt(); I also have a .cpp file which calls this function: int b = getDisplayPt(); It all builds and links beautifully. Now I need to change the function. The new…
Monday to Friday
  • 239
  • 5
  • 16