Undefined Reference to [duplicate]

Usually headers guards are for header files (i.e., .h ) not for source files ( i.e., .cpp ). Include the necessary standard headers and namespaces in source files. LinearNode.h: #ifndef LINEARNODE_H #define LINEARNODE_H class LinearNode { // ….. }; #endif LinearNode.cpp: #include “LinearNode.h” #include <iostream> using namespace std; // And now the definitions LinkedList.h: #ifndef … Read more

undefined reference to `__stack_chk_fail’

libgurobi_c++.a was compiled with -fno-stack-protector (obviously). A few things come to mind: add -fstack-protector when linking. This will make sure that libssp gets linked. Manually link -lssp Make your dummy version of __stack_chk_fail(void) in it’s own object file and and add this .o file to your linker command AFTER libgurobi_c++.a. GCC/G++ resolves symbols from left … Read more

gcc: undefined reference to

However, avpicture_get_size is defined. No, as the header (<libavcodec/avcodec.h>) just declares it. The definition is in the library itself. So you might like to add the linker option to link libavcodec when invoking gcc: -lavcodec Please also note that libraries need to be specified on the command line after the files needing them: gcc -I$HOME/ffmpeg/include … Read more