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

Undefined reference to member function (C++)

I am using a Makefile to compile a C++ project, and I receive an undefined reference error which I suspect is for a simple mistake. The error itself is: $ make g++ -c main.cpp g++ -o p5 main.o main.o:main.cpp:(.text+0x241): undefined reference to…
Eamon Bohan
  • 522
  • 2
  • 8
  • 22
0
votes
1 answer

boost python wrapper in dynamic library undefined reference

I'm currently trying to put part of a complex program into a dynamic library. This part consists of some classes that are also wrapped with boost python into a module to be embedded again. Here is a simplified version of the dll…
jean-claude91
  • 167
  • 1
  • 2
  • 10
0
votes
2 answers

undefined reference to functions in C++ Program using SimpleSocket written using Code::Blocks

I'm trying to write a C++ program in Code::Blocks that uses SimpleSockets. The files in my program are in my program, main.cpp, simplesocket.cpp, passivesockets.cpp, activesockets.cpp, simplesocket.h, passivesockets.h, activesockets.h. All of…
User4679
  • 111
  • 3
  • 12
0
votes
2 answers

Undefined reference calling an assembly function in C

I just cannot find the solution to this issue.. What I'm trying to do is calling an assembly function using gcc. Just take a look: // Somewhere in start.s global _start_thread _start_thread: ; ... // Somewhere in UserThread.cpp extern void…
Stefan Falk
  • 23,898
  • 50
  • 191
  • 378
0
votes
3 answers

Undefined reference to 'Class::Class'

Possible Duplicate: Why can templates only be implemented in the header file? I ran into this wall before, but I've no idea how to fix it. In g++ I get this error whenever I try to create an object of class…
0
votes
2 answers

undefined reference to function called 'full_adder(BIT A, BIT B, BIT Ci, BIT *Co)'

I am a CS student learning how to program in C. I have 3 files and a Makefile. I have logic.c logic.h main.c the top of logic.c is: #include "logic.h" //use this function in 4 bit adder //BIT full_adder(BIT A, BIT B, BIT Ci, BIT *Co); int…
Clara
  • 281
  • 1
  • 3
  • 13
0
votes
2 answers

C++ undefined reference to method and What if all stuff go to .h?

The simple C++ code I wrote below got compile error "undefined reference to 'featureExtract()'" (using codeblocks under windows), in FeaureExtract.h #ifndef FEATUREEXTRACT_H_INCLUDED #define FEATUREEXTRACT_H_INCLUDED extern void…
vancexu
  • 1,548
  • 3
  • 19
  • 30
0
votes
3 answers

Undefined reference to 'imp____glewEnableVertexAttribArray'

I'm trying to compile a program I am doing from a tutorial which is written in C++ and open gl 2.1. However, I don't like FreeGLUT so I decided to change the windowing program to SFML. My problem is however when I try to build the program I get…
Darestium
  • 643
  • 2
  • 11
  • 29
0
votes
1 answer

cegcc: failed linking import library compiled with vc++ (mangling issue)

I have application for Windows Mobile 6. To build it I use cegcc (arm-mingw32ce). Now I have new device with new SDK and some functions from this SDK must be added to this application. Here comes SDK. header.h #ifndef _HEADER_H_ #define…
zakrzak
  • 543
  • 1
  • 4
  • 7
0
votes
2 answers

Fortran undefined reference to

I'm trying to compile fortran code given to me by a labmate to run some analyses. The program involves calling MATLAB scripts to calculate certain things. The files he gave me were set up to run on a different computer and I'm trying to get them…
Brutus
  • 93
  • 5
0
votes
1 answer

Undefined Reference to ' '

I have an rpcgen generated file 'api_svc1.c' The file contains the following line: local = (char *(*)(char *, struct svc_req *)) createacct_5_svc; 'createacct_5_sv' is declared in 'api.h' as createAcctResult * createacct_5_svc(); But even after…
Blackforest
  • 1,009
  • 2
  • 11
  • 18
0
votes
2 answers

undefined reference while using shared library

I want to use one program as a shared library for an other program. I started as follows: I have a application which I have compiled using: /usr/bin/g++ -I/usr/include/libxml2 -Xlinker -zmuldefs -fPIC -c a.cpp /usr/bin/g++ -I/usr/include/libxml2 …
0
votes
3 answers

can't fix undefined reference to vtable

I've been searching for a while and have found a lot of threads/pages that involve the problem I have, but I am not able to find An explanation of why this error occurs A working solution for my specific case The following is Scanner.h: class…
Niklas R
  • 16,299
  • 28
  • 108
  • 203
0
votes
1 answer

1120: Access of undefined property [instantiated variable]? (Flex)

I have looked at questions like this, this, this and this, but none of these seem to describe my problem? I am declaring these variables:
0
votes
1 answer

Rails - reset_column_information does not work

I am renaming one column ("old_name" to "new_name") and converting other column ("column2") from integer to boolean in a Rails migration: def up rename_column :my_models, :old_name, :new_name unless column_exists?(:my_models, :new_name) …
Paul
  • 25,812
  • 38
  • 124
  • 247