I wrote a code split into several .h, .cpp files two functions take string type arguments (the code fragment below) I am getting this error:
/usr/bin/ld: /tmp/cclLgueo.o: in function `main':
main.cpp:(.text+0x1dc): undefined reference to `doloop(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: main.cpp:(.text+0x238): undefined reference to
`detect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
collect2: error: ld returned 1 exit status
What does it mean? Code:
//File: main.cpp (fragment)
string loop;
doloop(loop);
Header:
#ifndef func_h
#define func_h
#include <string>
using namespace std;
void detect(string cmd);
... void
void doloop(string con);
... void
#endif
func.cpp:
void doloop(string con)
{
short y; // Fragment
}
//detect function is similar
##Compiler command: "g++ main.cpp"