undefined-reference

Is there a way to ignore unused undefined references?

不问归期 提交于 2019-12-19 07:24:31
问题 Suppose I have two source files — UndefErr.cpp : #include <cstdio> void UndefFunc(); void Func2(){UndefFunc();} void Func1(){printf("Hi\n");} And the main.cpp : void Func1(); int main(){ Func1(); return 0; } As you see in the UndefErr.cpp the Func2() going to trigger an error, for it using the undefined UndefFunc() . However the main function doesn't care about the Func2() ! According to a relevant question I could pass an option --unresolved-symbols=ignore-in-object-files to the linker, but

Undefined References to _imp____glew* functions with minGW gcc

混江龙づ霸主 提交于 2019-12-19 04:16:21
问题 I am trying to compile a relatively simple OpenGL program using MinGW on a Win 7 x64 system, and I keep getting undefined references to several of the GLEW functions. I have set the libraries to link to the programs, and have been looking around for any library I may be missing from my list, yet the output from the linker still looks like this: 16:35:50 **** Incremental Build of configuration Debug for project test **** Info: Internal Builder is used for build gcc -LD:/DEV/openGL/lib/x86 -LD:

Undefined reference on very simple program

拜拜、爱过 提交于 2019-12-19 03:24:26
问题 Once I installed Ubuntu 11.10, strange error appears. I want to use GD with my C program, so I installed package "libgd2-xpm-dev". Everything was installed - files gd.h and libgd.a are in "/usr/include" and in "/usr/lib". So, I've tried to compile simple program with GD. #include <stdio.h> #include <gd.h> int main() { gdImagePtr im, im_clear; int black, white; FILE *out1; im = gdImageCreate(100, 100); im_clear = gdImageCreate(100, 100); white = gdImageColorAllocate(im, 255, 255, 255); black =

“Undefined reference” when accessing my shared library using JNI

有些话、适合烂在心里 提交于 2019-12-18 18:21:32
问题 I'm trying to build a version of Botan (library for cryptographic algorithms) using JNI to run a few native C++ programmes on Android. I've managed to create a libbotan.so without any errors using the NDK tool chain (NDK R5b). But when I'm compiling my source file (exampleError.cpp) from my Android project (Example) I get the following errors: Android NDK: WARNING: Unsupported source file extensions in /home/fensta/workspace /Example/jni/Android.mk for module botan Android NDK: sources

getting error in c program “undefined reference to gettid”

荒凉一梦 提交于 2019-12-18 14:54:51
问题 This is my thread sub routine... Here, I am creating 4 threads and passing structure as a argument to thread sub routine. I am trying to print thread id with getid() function, I am getting error saying "undefined reference to gettid()". I have added necessary header files... #include <pthread.h> #include <stdio.h> #include <sys/types.h> #define ARRAYSIZE 17 #define NUMTHREADS 4 struct ThreadData { int start, stop; int* array; }; void* squarer(void* td) { struct ThreadData* data=(struct

C++: Undefined reference to instance in Singleton class

天涯浪子 提交于 2019-12-18 07:46:10
问题 I'm currently trying to implement a factory as a singleton. I practically used the textbook example of the Singleton pattern. Here's the .h file: namespace oxygen{ class ImpFactory{ public: static boost::shared_ptr<ImpFactory> GetInstance(); private: static boost::shared_ptr<ImpFactory> mInstance; }; and here's the .cpp file: #include "impfactory.h" using namespace oxygen; using namespace boost; shared_ptr<ImpFactory> ImpFactory::GetInstance(){ if (mInstance.get() == 0) mInstance = shared_ptr

C++:Undefined reference to 'FMOD:: X'

走远了吗. 提交于 2019-12-17 20:39:11
问题 After looking around for various sound API libraries, I have decided to use FMOD for the time being. Problem is that whenever I try to compile one of the code examples, I get the following errors: obj\Release\main.o:main.cpp|| undefined reference to `FMOD::System::getVersion(unsigned int*)@8'| obj\Release\main.o:main.cpp|| undefined reference to `FMOD::System::init(int, unsigned int, void*)@16'| obj\Release\main.o:main.cpp|| undefined reference to `FMOD::System::createSound(char const*,

C-callback to function template: explicitly instantiate template

依然范特西╮ 提交于 2019-12-17 19:15:45
问题 Premise I’m using a C library (from C++) which provides the following interface: void register_callback(void* f, void* data); void invoke_callback(); Problem Now, I need to register a function template as a callback and this is causing me problems. Consider the following code: template <typename T> void my_callback(void* data) { … } int main() { int ft = 42; register_callback(reinterpret_cast<void*>(&my_callback<int>), &ft); invoke_callback(); } This gives me the following linker error (using

Undefined reference to template members

我的未来我决定 提交于 2019-12-17 13:46:26
问题 I'm new to C++, and preparing a homework by using NetBeans IDE on Ubuntu 10.04. I use g++ as a C++ compiler. The error message: build/Debug/GNU-Linux-x86/Maze.o: In function `Maze': Maze/Maze.cpp:14: undefined reference to `Stack<Coordinate>::Stack()' Maze/Maze.cpp:14: undefined reference to `Stack<Coordinate>::Stack()' Maze/Maze.cpp:69: undefined reference to `Stack<Coordinate>::push(Coordinate)' Maze/Maze.cpp:79: undefined reference to `Stack<Coordinate>::isEmpty()' Maze/Maze.cpp:87:

Undefined Reference to

余生颓废 提交于 2019-12-17 09:30:30
问题 When I compile my code for a linked list, I get a bunch of undefined reference errors. The code is below. I have been compiling with both of these statements: g++ test.cpp as well as g++ LinearNode.h LinearNode.cpp LinkedList.h LinkedList.cpp test.cpp I really do not understand why I am getting these errors because I am really rusty on classes in C++. I could really use some help. LinearNode.h: #ifndef LINEARNODE_H #define LINEARNODE_H #include<iostream> using namespace std; class LinearNode