undefined-reference

Linking time "undefined reference to " errors

Hi All, I'm having a hard time writing makefiles. I have experience in using the extern variables, when I build the project without using makefiles I get absolutely no errors and I can run the program. But from the time I wrote the makefile to build the project, I'm getting undefined reference to errors. I have more than 3 files with ...

Getting undefined references when linking against a static library

I made a static library with GCC. Building of the library was OK. When I use it the linker throws undefined reference errors on some functions. But nm says the functions are defined and exported in the static library (marked with T). I know about the linking order that I need to put the libraries after that module that needs them so thi...

Why is my .cpp file not being processed?

I'm trying to compile (make) a game source and it seems that my gRace.cpp file is being excluded or something because it keeps returning undefined reference errors for all my gRace class methods. libtron.a(libtron_a-gGame.o): In function `gGame::StateUpdate()': gGame.cpp:(.text+0x99e9): undefined reference to `gRace::Reset()' libtron.a(...

Problem using SDCC in a Makefile during the link step

The Small Device C Compiler (SDCC) will produce a ihx (Intel Hex) file even if there are undefined reference errors during the link step. This behavior causes problems when using SDCC in a Makefile because if you set the ihx file to be your make target, then make has no good way of knowing that a previous attempt at linking has failed. ...

gcc wont compile and run MySQL C libraries

#include <my_global.h> #include <mysql.h> int main(int argc, char **argv) { printf("MySQL client version: %s\n", mysql_get_client_info()); } ~$ gcc -o mysql-test MySQL-Test.c im trying to execute this test program from terminal but get the following error message: /tmp/cceEmI0I.o: In function main': MySQL-Test.c:(.text+0xa): ...

undefined reference with member implelementation of a templated class.

Hi! This is wholy mysterious to me. I'm using g++ on ubuntu, and this is some of my code (with class names change, but nothing else because I'm still using stubs everywhere): Bob.hpp template <class A> class Bob : public Jack<Chris, A> { public: Bob(int x1, int x2, float x3 = 1.0, float x4 = 2.0, float x5 = 3.0) throw(Exc...

c++ " undefined reference to 'Foo::Foo(std::string)' "

I'm not too familiar with c++ and how instantiating objects work, so this is probably a very simple thing to solve. When I compile with g++ I get the error " undefined reference to 'Foo::Foo(std::string)' ". I want to create an instance of the class Foo that has a string parameter in its constructor. Here is the code: Foo.h #include...

undefined reference when using extern

I have the following setup (hopefully this is not too bare an example): A.h typedef std::map<unsigned int, float> MyClass; extern MyClass inst; A.cpp MyClass inst; B.h #include <A.h> void foo(); B.cpp #include <B.h> void foo { inst.myClassFunc(); } Now, when I use inst in B.cpp I get undefined reference to inst. Any id...

undefined reference error

hey, i got undefined reference error from my main function, but i can not find the problem. my files are: //Student.h #ifndef STUDENT_H #define STUDENT_H #include <vector> #include <string> class Student{ public: Student(std::string &line); ... virtual void evaluateValue(){} virtual ~Student(){} .... }; #endif //HeStudent.h #ifndef...

Undefined reference to ClassName::ClassName

Hi all! I'm using Code::Blocks to build my project, which contains three files: main.cpp, TimeSeries.cpp, TimeSeries.h. TimeSeries.h provides declarations for the TimeSeries class as follows: template<class XType, class YType> class TimeSeries { public: TimeSeries(void); ~TimeSeries(void); }; Then TimeSeries.cpp contains: ...

Building llvm-gcc: linker errors

Hi, I have downloaded llvm and llvm-gcc sources to my machine. I was able to build both of them fine. Then I created a new source file in LLVM Analysis folder which calls into another library (sqlapi). I installed this lib into the usual LLVM libs location. I am able to build LLVM fine but when I try to build LLVM-GCC I get undefined s...

Undefined references

Linker Error: $ make g++ -Wall -g main.cpp SDL_Helpers.cpp Game.cpp DrawableObject.cpp `sdl-config --cflags --libs` -lSDL_mixer /tmp/ccdxzrej.o: In function `Game': /home/brett/Desktop/SDL/Game.cpp:16: undefined reference to `Player::Player(Game*)' /home/brett/Desktop/SDL/Game.cpp:16: undefined reference to `Player::Player(Game*)' colle...

C++ - Undefined reference issues when working with classes

Hello, everyone, I am working on a small project where I use multiple classes. One of those classes is Menu, which has a showContainer method. Here's the class declaration: class Menu { //snip Menu(); Menu(std::string, std::string, int, int); virtual ~Menu(); //snip /** * Visualiza e providencia navegacao p...

Undefined reference to member functions

I had just thought I resolved a problem, but it seemed another one cropped up--or at least the same problem in another form. Now when I try to rebuild everything as suggested in the answer to that question, all Qt Creator shows in build issues is a one line collect2: ld returned 1 exit status Here's some of the compile output that I thi...