undefined-reference


undefined reference to `sin', even though I use <math.h> and -lm [duplicate]

僤鯓⒐⒋嵵緔 提交于 2020-01-20 08:56:51
问题 This question already has answers here : Undefined reference to 'pow' even though -lm is a compile flag. [C] (2 answers) Closed 23 days ago . I noticed that when I use sin inside function the compiler don't recognize it, here is an example: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> float sinus(float a){ return sin(a);} int main(int argc, char **argv) { double a = sinus(2); printf("%f \n", sin(2)); printf("%f", a); return 0; } If I use it directly in main it

Undefined reference to mempcy@GLIBC_2.14 when compiling on Linux

六月ゝ 毕业季﹏ 提交于 2020-01-19 01:49:26
问题 I am trying to port an application to drive a device that uses an ftdi2332h chip from windows to linux. I installed the libftd2xx library on an ubuntu 10.04 system per these instructions. When I try to compile any of the sample programs I get the following error: /usr/local/lib/libftd2xx.so: undefined reference to `memcpy@GLIBC_2.14' collect2: ld returned 1 exit status Any guidelines on how to fix this? 回答1: The mempcy@GLIBC_2.14 is called a versioned symbol. Glibc uses them while other

Undefined reference to mempcy@GLIBC_2.14 when compiling on Linux

旧城冷巷雨未停 提交于 2020-01-19 01:49:05
问题 I am trying to port an application to drive a device that uses an ftdi2332h chip from windows to linux. I installed the libftd2xx library on an ubuntu 10.04 system per these instructions. When I try to compile any of the sample programs I get the following error: /usr/local/lib/libftd2xx.so: undefined reference to `memcpy@GLIBC_2.14' collect2: ld returned 1 exit status Any guidelines on how to fix this? 回答1: The mempcy@GLIBC_2.14 is called a versioned symbol. Glibc uses them while other

What is an undefined reference/unresolved external symbol error and how do I fix it?

佐手、 提交于 2020-01-16 19:47:05
问题 What are undefined reference/unresolved external symbol errors? What are common causes and how to fix/prevent them? Feel free to edit/add your own. 回答1: Compiling a C++ program takes place in several steps, as specified by 2.2 (credits to Keith Thompson for the reference): The precedence among the syntax rules of translation is specified by the following phases [see footnote] . Physical source file characters are mapped, in an implementation-defined manner, to the basic source character set

Undefined reference to my own library

余生长醉 提交于 2020-01-15 08:48:25
问题 I've created my lib.a file with several gcc -c file.c -o file.o then ar sr lib/libtest.a file1.o file2.o file3.o confirmed with ar -t lib/libtest.a file1.o file2.o file3.o but when I try to compile test aplication gcc lib/libtest.a test.c -o test I got undefined reference in function main : to used function from file1.o, file2.o, file3.o 回答1: Order matters with libraries - try: gcc test.c -o test lib/libtest.a Basically, the linker reads the library when it comes across it on the list of

Calling a C++ function from a C program

南楼画角 提交于 2020-01-14 04:42:08
问题 How can I call a C++ function from a C program, is it possible?, and if it is how can I do it?. Thank you. 回答1: If you are trying to call a C++ function from C, then you are probably running into name mangling issues. The compiler does this in order to support function overloading and other features of C++. You can use extern "C" to inform the C++ compiler that the function CMACInit() will be called from C code: extern "C" CMACInit() { ... } When declared in this way, the C++ compiler will

Undefined reference to

徘徊边缘 提交于 2020-01-11 12:32:29
问题 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

无人久伴 提交于 2020-01-11 12:32:29
问题 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

一曲冷凌霜 提交于 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

工具导航Map