Reputation: 615
I have extracted config4cpp into my projects directory under lib/config4cpp. I have ran the make file in lib/config4cpp.
I have added this include at the top of my projects cpp file
#include "lib/config4cpp/include/config4cpp/Configuration.h"
I have this line in my make file
g++ -L./lib -c queue.cpp -lcurl -lconfig4cpp
I am getting this error
g++ -c -o queue.o queue.cpp
In file included from queue.cpp:4:0:
lib/config4cpp/include/config4cpp/Configuration.h:35:34: fatal error: config4cpp/namespace.h: No such file or directory
#include <config4cpp/namespace.h>
^
compilation terminated.
<builtin>: recipe for target 'queue.o' failed
make: *** [queue.o] Error 1
So it looks like its finding the Configuration.h file but then one of its other headers cant be found.
I have also tried
g++ -I"lib/config4cpp/include/" -c queue.cpp
And changed the header include to
#include <config4cpp/Configuration.h>
But I get the same error where it cant find the namespace.h file
This seems to be some thing related to being run from inside my make file.
output: main.o queue.o
g++ main.o queue.o -o"bin/behavior"
main.o: main.cpp
g++ -c main.cpp
message.o: queue.cpp
g++ -c queue.cpp -L"./lib" -lconfig4cpp -I"./lib/config4cpp/include"
clean:
rm *.o bin
Upvotes: 0
Views: 1116
Reputation: 81
From what I can see you have not given the -I argument to g++ so the following happens :
You give an absolute path to the header that you want to use. This header is now "located" inside you local folder (the one where you .cpp files are). When it tries to include "config4cpp/namespace.h" it looks inside the current folder. But you don't have a "config4cpp/namespace.h" file locally.
What you need to do is add :
-I"lib/config4cpp/include/"
As an argument to g++ with the following folder structure :
$BASE_DIR
|-- config_test.cpp
|
|--lib
| |-- config4cpp.a
| |
| |-- config4cpp
| | |-- include
| | | |-- config4cpp
| | | | |-- Configuration.h
| | | | |-- namespace.h
| | | | |-- ConfigurationException.h
Upvotes: 1