undefined-reference

Undefined reference to

一曲冷凌霜 提交于 2020-01-11 12:32:21
问题 I keep getting this error message every time I try to compile, and I cannot find out what the problem is. any help would be greatly appreciated: C:\DOCUME~1\Patrick\LOCALS~1\Temp/ccL92mj9.o:main.cpp:(.txt+0x184): undefined reference to 'List::List()' C:\DOCUME~1\Patrick\LOCALS~1\Temp/ccL92mj9.o:main.cpp:(.txt+0x184): undefined reference to 'List::add(int)' collect2: ld returned 1 exit status code: //List.h #ifndef LIST_H #define LIST_H #include <exception> //brief Definition of linked list

undefined reference to `__ubsan_handle_nonnull_arg' [duplicate]

独自空忆成欢 提交于 2020-01-06 14:47:28
问题 This question already has answers here : Using GCC Undefined Behavior Sanitizer (2 answers) Closed last year . I have been working on the problem set speller for the last days and so far this is what I have. Unfortunately, it does not compile and I am a bit lost. I would be really grateful if somebody can help me out and tell me, what I am doing wrong. // Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <string.h> #include <strings.h> #include <stdlib.h

linking pgi compiled library with gcc linker

ε祈祈猫儿з 提交于 2020-01-03 05:50:06
问题 I would like to know how to link a pgc++ compiled code (blabla.a) with a main code compiled with c++ or g++ GNU compiler. For the moment linking with default gnu c++ linker gives errors like: undefined reference to `__pgio_initu' 回答1: As the previous person already pointed out, PGI supports G++ name mangling when using the pgc++ command. Judging from this output, I'm guessing that you're linking with g++ rather than pgc++. I've had the most success when using pgc++ as the linker so that it

undefined reference to symbol 'pthread_key_delete@@GLIBC_2.2.5

旧城冷巷雨未停 提交于 2020-01-01 08:26:27
问题 I'm trying to make a file in Ubuntu and when i make i keep getting this error: /usr/bin/ld: ../../gtest-1.7.0/libgtest.a(gtest-all.cc.o): undefined reference to symbol 'pthread_key_delete@@GLIBC_2.2.5' /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[2]: *** [src/tests/run_tests] Error 1 make[1]: *** [src/tests/CMakeFiles/run_tests.dir/all] Error 2 make: *** [all] Error 2 I saw someone mentioning to go

C code compiled with C++: undefined reference

时光怂恿深爱的人放手 提交于 2020-01-01 04:54:11
问题 I have a small program that I can compile with GCC and ICC without any difficulties, but I would also like the code to work with G++ and ICPC. I tried to add this: #ifdef __cplusplus extern "C" { #endif at the beginning and this: #ifdef __cplusplus } #endif at the end of all the header files, but I still get several `undefined reference to "..."' errors. 回答1: I think you're getting it wrong... The extern C is for disabling the function mangling; so if you do it just for the header files, when

'Undefined reference to function' issue even after linking the library which has the defination

烈酒焚心 提交于 2019-12-31 05:28:41
问题 I am trying to create an executable with .o ,.so, .a files. Here is my build command:- pkgs/gcc/v4.8.3/bin/gcc -L/usr/X11R6/lib -O2 -DUSE_FLEX -Wall -Wno-char-subscripts -fPIC -DLINUX -DG_DISABLE_CONST_RETURNS -fno-strict-aliasing -o ../build/kl/Release/test/bin/pure.exe -L../build/kl/Release/test/modules ../build/kl/Release/test/maker/constrfunc.TCL.o ../../build/kl/Release/test/maker/pvdbprocs.TCL.o .. ../build/kl/Release/test/maker/maker/memmaker.TCL.o .. ../build/kl/Release/test/maker

C program cannot find function which included in header file

▼魔方 西西 提交于 2019-12-31 04:40:14
问题 I made program like this. 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 #include "libavformat/avformat.h" 5 6 int main (int argc, char* argv[]){ 7 av_register_all(); 8 return 0; 9 } My header file located in root@ubuntu:/home/juneyoungoh/getDuration# find / -name "avformat.h" /root/ffmpeg/libavformat/avformat.h /usr/local/include/libavformat/avformat.h then I run with gcc getDuration.c , but I show message like below. root@ubuntu:/home/juneyoungoh/getDuration# gcc

Undefined Reference to class static member in static member

ε祈祈猫儿з 提交于 2019-12-30 14:24:23
问题 I am creating a linked list with self referential class in C++ and I want to have a static pointer of the type Item (Item is the class name) named "startPointer" so that when i call my static member function "free" , it can free up the memory by using Item::startPointer but i am getting an error(shown after code). Pls Help, class Item { public: std::string name; int row,column; int fileType; Item *ptr; static Item *startPointer; void setNextPointer(Item* ptr) { ptr=ptr; } Item *getNextPointer

.dll Plugin that uses functions defined in the main executable

99封情书 提交于 2019-12-30 10:04:20
问题 I have a Main executable that loads . dll / .so Plugins, which works just fine in Linux but on windows(Visual Studio 2012), it fails with undefined reference errors. The plugin uses functions like session->SendLine("bla") which are defined in the Main executable. (class of session ans methods defined in a .h included in the plugin, but the actual function in a .cpp compiled in main exec). tl;dr: "I need the windows linker to ignore undefined references in plugins, defined in the main

.dll Plugin that uses functions defined in the main executable

允我心安 提交于 2019-12-30 10:02:46
问题 I have a Main executable that loads . dll / .so Plugins, which works just fine in Linux but on windows(Visual Studio 2012), it fails with undefined reference errors. The plugin uses functions like session->SendLine("bla") which are defined in the Main executable. (class of session ans methods defined in a .h included in the plugin, but the actual function in a .cpp compiled in main exec). tl;dr: "I need the windows linker to ignore undefined references in plugins, defined in the main