Please bear with me if this is a naive question. I tried to see if this was answered elsewhere on SO, but I didn't quite find a question that answered this.
I see an error when I try to compile some C++ code (test.cpp). I am including some headers, as follows -
#include <iostream>
#include <string>
#include "lefrReader.hpp"
lefrReader.hpp has the definition of function lefrInit(), and is present in the folder /foo/bar/include, say.
I am compiling this code with the following (in a UNIX environment) -
g++ -I/foo/bar/include -L/foo/bar/include ./test.cpp -o ./test
However, this fails with this error -
test.cpp:(.text+0x11): undefined reference to `lefrInit()'
collect2: ld returned 1 exit status
Shouldn't having the /foo/bar/include directory in the include (-I) path help with finding lefrReader.hpp?
EDIT - I also tried the following to no avail (from What is an undefined reference/unresolved external symbol error and how do I fix it?) -
g++ -I/foo/bar/include -L/foo/bar/include ./test.cpp -o ./test -llefrReader
Error -
test.cpp:(.text+0x11): undefined reference to `lefrInit()'
collect2: ld returned 1 exit status