Monday, 14 January 2019

c++ - Cannot link object files because of undefined reference

I cannot link object files. Compilation works fine, but the linker gives me these error messages:




testArguments.o: In function Z6__mainiPPc':
/cygdrive/c/Users/Lukas/work/ProxyServer/src/test/testArguments.cpp:5:
undefined reference to
Arguments::Arguments()'
/cygdrive/c/Users/Lukas/work/ProxyServer/src/test/testArguments.cpp:6:
undefined reference to Arguments::insertItem(int)'

/cygdrive/c/Users/Lukas/work/ProxyServer/src/test/testArguments.cpp:8:
undefined reference to
_Unwind_Resume' testArguments.o: In function
ZNSt10_List_baseIiSaIiEED2Ev':
/usr/lib/gcc/i686-pc-cygwin/4.8.2/include/c++/bits/stl_list.h:378:
undefined reference to
_Unwind_Resume' testArguments.o: In function
ZN9__gnu_cxx13new_allocatorISt10_List_nodeIiEE10deallocateEPS2_j':
/usr/lib/gcc/i686-pc-cygwin/4.8.2/include/c++/ext/new_allocator.h:110:
undefined reference to
operator delete(void*)'
testArguments.o:testArguments.cpp:(.eh_frame+0x13): undefined
reference to __gxx_personality_v0'

testArguments.o:testArguments.cpp:(.eh_frame$_ZNSt10_List_baseIiSaIiEED2Ev+0x13):
undefined reference to
__gxx_personality_v0' Makefile:7: recipe for
target 'tests' failed




But these functions are defined in the cpp file (Argument::Arguments() Arguments::insertItem(int)



Here is my header file:



#ifndef ARGUMENTS_H 


#define ARGUMENTS_H

#include


using std::list;
template
class Arguments{


public:

Arguments(list args);>

Arguments()>;

void insert>Item(T item);

list getValues();


private:

list values;
};
#endif


Here the cpp file:



#include "include/Arguments.h"

#include
using std::list;

template Arguments::Arguments(list args) {

values = args;

}

template Arguments::Arguments() {


}

template void Arguments::insertItem(T argument){
values.push_back(argument);
}

template list Arguments::getValues() {
return this.values;


}

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...