undefined-reference

Undefined reference to

為{幸葍}努か 提交于 2019-12-02 06:29:00
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 class class List { public: /** \brief Exception for operating on empty list */ class Empty : public std:

Is there a way to cope with undefined reference error for template functions without implementing them in header?

笑着哭i 提交于 2019-12-02 05:55:36
I hope the problem is clear. Is there an alternative way not to get undefined reference error without implementing template functions in header files? Thanks in advance. Marshall Cline's C++-FAQ already deals with this . One way is to use export but I don't really recommend using it because not all compilers support it really! In fact C++0x Committee has voted out export out of the next C++ Standard. If you know in advance which all instantiations you will need, you can instantiate them manually. 来源: https://stackoverflow.com/questions/5369021/is-there-a-way-to-cope-with-undefined-reference

C program cannot find function which included in header file

只谈情不闲聊 提交于 2019-12-02 04:36:33
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 getDuration.c /tmp/ccwjonqH.o: In function `main': getDuration.c:(.text+0x10): undefined reference to `av

Undefined reference to RSA_generate_key in OpenSSL? [duplicate]

为君一笑 提交于 2019-12-02 02:06:08
问题 This question already has answers here : Linking libssl and libcrypto in GCC [duplicate] (2 answers) Closed 3 years ago . I have the following code in the file rsatest.c . I'm trying to generate a RSA key pair. #include <openssl/rsa.h> #include <openssl/pem.h> int main(){ RSA *rsa = RSA_generate_key((const int) 1024,(const int) 3, 0, 0); return 0; } I'm compiling this with gcc -I../include/ -L . -lcrypto -lssl rsatest.c and I get the following error. undefined reference to `RSA_generate_key'

Undefined reference to RSA_generate_key in OpenSSL? [duplicate]

微笑、不失礼 提交于 2019-12-02 00:36:21
This question already has an answer here: Linking libssl and libcrypto in GCC [duplicate] 2 answers I have the following code in the file rsatest.c . I'm trying to generate a RSA key pair. #include <openssl/rsa.h> #include <openssl/pem.h> int main(){ RSA *rsa = RSA_generate_key((const int) 1024,(const int) 3, 0, 0); return 0; } I'm compiling this with gcc -I../include/ -L . -lcrypto -lssl rsatest.c and I get the following error. undefined reference to `RSA_generate_key' Am I linking the library files in the wrong order? I made the libcrypto.a and libssl.a on windows (64 bit), with msys and

compile opencv2.3.1 in ubuntu 11.10

你。 提交于 2019-12-01 23:27:16
Here is the tutorial I followed: http://thebitbangtheory.wordpress.com/2011/10/23/how-to-install-opencv-2-3-1-in-ubuntu-11-10-oneiric-ocelot-with-python-support/ I think the problem is ffmpeg, the version I used is 0.8.10, and I installed it in /usr and enabled share, but when I complied opencv,the output was full of ./../lib/libopencv_highgui.so.2.3.1: undefined reference to av_codec_get_id' ../../lib/libopencv_highgui.so.2.3.1: undefined reference to av_seek_frame' ../../lib/libopencv_highgui.so.2.3.1: undefined reference to `avpicture_get_size Check your LD_LIBRARY_PATH and PKG_CONFIG_PATH,

How to link curses.h in Cmake?

时间秒杀一切 提交于 2019-12-01 22:08:31
I know that maybe this is a silly question but I can't see through it, I searched for other answers here, that are pretty close to mine, but, still, I didn't understand how to do it. The problem is that I can't compile a 'C' program that uses curses.h in Windows (I'm using Clion with MinGW), when I try to do it, it gives "undefined reference" for functions in curses.h (Such as 'initscr', 'clear', ...). Through MinGW Installation Manager I installed "mingw-32-libpdcurses" (There were two available with two different classes: dev and dll; I installed the dll one). The CMAKEfile i'm using is this

Strange Compiler Error: “undefined reference to 'main'”

天涯浪子 提交于 2019-12-01 18:55:56
问题 Could someone tell me what this means? /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../crt1.o: In function `_start': (.text+0x18): undefined reference to `main' collect2: ld returned 1 exit status make: *** [program] Error 1 My make file looks like as follows: program : main.o render.o screenwriter.o g++ -o main.o render.o screenwriter.o -lSDL main.o : main.cpp render.h screenwriter.h g++ -c main.cpp render.h screenwriter.h -lSDL render.o : render.h render.cpp g++ -c render.h render

Strange Compiler Error: “undefined reference to 'main'”

守給你的承諾、 提交于 2019-12-01 18:24:20
Could someone tell me what this means? /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../crt1.o: In function `_start': (.text+0x18): undefined reference to `main' collect2: ld returned 1 exit status make: *** [program] Error 1 My make file looks like as follows: program : main.o render.o screenwriter.o g++ -o main.o render.o screenwriter.o -lSDL main.o : main.cpp render.h screenwriter.h g++ -c main.cpp render.h screenwriter.h -lSDL render.o : render.h render.cpp g++ -c render.h render.cpp -lSDL screenwriter.o : screenwriter.h screenwriter.cpp g++ -c screenwriter.h screenwriter.cpp

Undefined Reference to class static member in static member

邮差的信 提交于 2019-12-01 14:38:12
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() { return ptr; } static void free() { Item *p,*temp; p=startPointer; while(p!=NULL) { temp=p; p=p-