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
4
votes
2 answers

compiling openGL + GLSL gives undefined reference

i am trying to compile this one piece of code from internet and i am failing miserably. seems like opengl libs are missing - but they are there - i checked. same goes with glut and glew. system is Ubuntu 12.04, glxinfo confirms the video adapter is…
Chris
  • 570
  • 2
  • 9
  • 19
4
votes
2 answers

Can't link application with mudflap

My application uses my shared library. Application and library must be mudflapped to check out of bounds reads and writes both on stack and heap. Shared library was successfully build, but while linking application I had a lot of errors. I made a…
4
votes
1 answer

Make my C function call from my CUDA code

I have cuda code which makes a call to a function present in a .c file whose header file I have included in my cuda code. So, in all I have a header file, a C file for that header file, and a CUDA code. When I am compiling my CUDA code using nvcc…
user1439690
  • 659
  • 1
  • 11
  • 26
4
votes
2 answers

c++ undefined reference to `vtable

My question has changed from the other one I have posted. I started out with multiple files and decided to put it all in one main.cpp file for now just to get it working. main.cpp: #include using namespace std; class arrayListType { …
Jeff
  • 4,285
  • 15
  • 63
  • 115
4
votes
3 answers

Undefined reference to a derived class

EDIT: RELATED TO c++ undefined reference to `vtable I am trying to do a project on inheritance and I'm getting this error: /tmp/ccw1aT69.o: In function `main': main.cpp:(.text+0x15): undefined reference to `Derived::Derived(int)' /tmp/ccw1aT69.o: In…
Jeff
  • 4,285
  • 15
  • 63
  • 115
4
votes
1 answer

c++ linker error: undefined references only on optimized build

I'm getting an undefined references linker error only when linking optimized objects files, not when linking unoptimized object files. I don't understand what the problem is or could be. Here is my unoptimized build: Building file:…
synaptik
  • 8,971
  • 16
  • 71
  • 98
4
votes
3 answers

Undefined Reference Error When Linking to Static Library

I am trying to compile a project that depends on the Xerces XML Parser. The project compiles for Windows without any difficulty, but I'm having some trouble compiling it with g++ in Cygwin. In order to use Xerces, I am trying to compile my code…
theisenp
  • 8,639
  • 5
  • 39
  • 47
3
votes
1 answer

libconfig undefined reference to libconfig::Config::Config()

I'm trying to build a game engine, and I've turned to libconfig to handle all my configuration needs. I'm in the process of building an asset manager that will use config files parsed by libconfig to load images, sounds, etc. I'm running into an…
Sean Hagen
  • 752
  • 10
  • 30
3
votes
1 answer

boost::program_options undefined reference

I use ubuntu 10.04 and libboost1.40. ls -l /usr/lib | grep boost_pro -rw-r--r-- 1 root root 640800 2010-04-01 05:19 libboost_program_options.a lrwxrwxrwx 1 root root 26 2011-11-03 22:40 libboost_program_options-mt.a -> …
3
votes
2 answers

C++ / Mysql Connector : undefined reference to `get_driver_instance'

I've found some topics on this forum concerning the same error, but I didn't find the solution in it. I'm trying to make work C++ & Mysql Connector on Ubuntu 11.04. My error is (after following official Mysql tutorial) /tmp/ccDmH4pd.o: In function…
Touki
  • 833
  • 2
  • 9
  • 20
3
votes
1 answer

Ocaml code which compiles, but does not go with toplevel

I am doing an exercise of a free course. The following ocaml code compiles when I "make", but it complains once I am trying to put it into toplevel. Why? let main () = (* Parsing arguments *) let f_name = ref "" in Arg.parse [ ] (fun s ->…
zell
  • 9,830
  • 10
  • 62
  • 115
3
votes
1 answer

How do properly set up VkDebugUtilsMessengerEXT?

I have tried to get this to work using several methods and no matter what I keep getting: /usr/local/include/vulkan/vulkan.hpp:2453: undefined reference to `vkCreateDebugUtilsMessengerEXT' /usr/local/include/vulkan/vulkan.hpp:2548: undefined…
R. Smyth
  • 175
  • 1
  • 8
3
votes
0 answers

How to ignore undefined references to libpangocairo library

I have set up a video streaming system with OpenCv and Cairo. Unfortunately, now when I attempt to build, I get all sorts of undefined references to libpangocairo-1.0.so.0. I'd like a solution where I can just ignore these undefined references, or…
3
votes
2 answers

Unsdefined reference to library class members errors from caller program

Additional Questions added below, 4/11/2011 I am developing a cross-platform set of shared libraries DLLs/Sos and tester programs in C++ though I have to be able to support C. The libraries will ship as object code only, but the tester program(s)…
Wes Miller
  • 2,191
  • 2
  • 38
  • 64
3
votes
2 answers

CMake - Undefined reference encountered when attempting to build project

I am currently trying to use CMake on Windows to build a C++ project that includes 2 libraries, GLEW and SDL2, but upon doing so I get an undefined reference error that looks as follows:- PS D:\Projects\C++Projects\game_engine\build>> cmg .. -- The…
vdn
  • 31
  • 1
  • 1
  • 3