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

OpenSSL compiles failed on x86 thought was successful for x86_64

I'm trying to compile my project for x86 and x86_64 architectures on Windows. Using 64bit GCC from mingwbuilds project (4.8.1 rev 5), OpenSSL 1.0.1e compiles and links successfully, but using 32bit version of same compiler I got undefined…
sorush-r
  • 10,490
  • 17
  • 89
  • 173
0
votes
1 answer

Undefined reference to "Str::ToInt(unsigned char*)"

I added a new function into my library, and while compiling Gcc refuse to recognize it. Every function works without problem, and this is the only one that give problem. String.hpp #ifndef __String_Included__ #define __String_Included__ namespace…
EnryFan
  • 422
  • 3
  • 15
0
votes
2 answers

FATAL EXCEPTION: main Unable to start activity ComponentInfo Caused by java.lang.NullPointerException

In the process of moving code from my main activity to an adapter I began experiencing an issue stating: The method findViewById(int) is undefined for the type VideosAdapter and The method getResources() is undefined for the type new…
user3009687
  • 369
  • 2
  • 7
  • 17
0
votes
1 answer

Undefined error

I have gotten an error that says undefined reference to `slope(double*, double*, double*, double*, double*, int, double)', but I have defined slope in my program. So I do not get what it is saying its undefined can someone please explain what is…
0
votes
3 answers

undefined reference to function c++

I have undefined reference to function : Entry.cpp (program entry): ................ ShowWindow(hWnd, nCmdShow); DX3D_DEFS_AND_FUNC dx3d_defsnfunc; dx3d_defsnfunc.initD3D(hWnd); MSG msg; while(TRUE) { while(PeekMessage(&msg, NULL, 0, 0,…
Jancis
  • 97
  • 1
  • 11
0
votes
0 answers

identifier not found with included class

I have the following "comuni.cpp" file #pragma once #include "afxwin.h" class Esame: public CObject { DECLARE_SERIAL(Esame) public: INT voto; INT crediti; BOOL lode; CString nome; Esame(CString nome, INT voto, BOOL lode,…
volperossa
  • 1,339
  • 20
  • 33
0
votes
0 answers

Link error: undef reference - friend function

Just the salient details: Compilation: g++ -c memref_test.cpp g++ -c -I/home/chap/private/WDI/git -I/home/chap/private/WDI/git/include -I/usr/local/mysql/include -I/usr/local/include -I/home/chap/private/WDI/git…
Chap
  • 3,649
  • 2
  • 46
  • 84
0
votes
1 answer

Undefined reference to `main' - Eclipse using libxml2

I am trying to compile a program in C using eclipse and I have an undefined reference to 'main' error, but my code has a main. The linker is using: -nostartfiles , -nodefaultlibs , -nostdlib It was using -c but I erased it because it gave me other…
Ita
  • 303
  • 5
  • 17
0
votes
1 answer

Undefined reference to _rpoly_ while linking C++ program with Fortran library

I've compiled the netlib implementation of the Jenkins and Traub rpoly formula for finding the zeros of a real polynomial) into a library as follows f77 -c toms493.f ar r rpoly.a toms493.o Next I tried to compile and link the following C++ program…
Olumide
  • 5,397
  • 10
  • 55
  • 104
0
votes
1 answer

Command prompt undefined reference to everything

I am trying to build an application which takes the users input, puts it into a vector/database, and outputs the results. When I input the code into my windows command prompt compiler it just get it gives me a path C:/users/app/data/local/temp and…
Daniel o Keeffe
  • 578
  • 2
  • 10
  • 25
0
votes
1 answer

Undefined references to functions in sub-library

First of all, I use c++11 on linux with g++4.7 for all parts of my problem. The setup of my problem: I created a shared library (lets call it "libA") that I use in different programs. Within this library is a part that was not exposed in the…
0
votes
2 answers

Actionscript 3 Dictionary returning undefined/null for key that has just been set in a different class

I'm rendering display objects to the stage depending on the given XML elements, as you can see here: PageRenderer.as private static var curElements:Dictionary = new Dictionary(); //renders the current page private static function…
Tom
  • 8,536
  • 31
  • 133
  • 232
0
votes
1 answer

working with acl.h - undefined reference to `acl_init' error

I want write simple C program to set ACL to one particular file on Linux. My starting code is trying to use function from "acl.h". I'm using Ubuntu 13.10, I've installed "Access control list utilities" - "acl 2.2.52-1". Here is my code: #include…
user2933357
  • 25
  • 1
  • 5
0
votes
1 answer

simple problem with makefile or header files?

i have a program that compiles using the following: g++ -I ../../include -I . -I ../ -I ../../ -I ../ Entity.cpp Attribute.cpp main.cpp -o main.o The Attribute.cpp includes its header file, Attribute.h, and Attribute.cpp contains all the…
user237163
  • 11
  • 3
0
votes
0 answers

Boost::Log/mingw64 Undefined reference

I have problems to use the Boost::Log library from Boost_1_54 release under Windows7 using mingw-w64 gcc-4.8.1. I can compile boost without any problems, but i am not able to link the following program correctly. #include…
IcePic
  • 293
  • 1
  • 10