0

I have a config file that contains:

#include "libconfig.h++"

I have installed libconfig via homebrew and I am trying to compile my c++ program so that I can use the library but I am having trouble linking to it.

The location of the libconfig .a files is located at /usr/local/Cellar/libconfig/1.4.9/lib/

The documentation says: To link with the library, specify ‘-lconfig++’ as an argument to the linker.

So I have been trying variations on g++ config.cpp -L /usr/local/Cellar/libconfig/1.4.9/lib -lconfig++ -o out.o

But I getting the same error message:

config.cpp:4:10: fatal error: 'libconfig.h++' file not found
#include "libconfig.h++"

Can someone please explain what I am doing wrong?

4

1 回答 1

1

链接器没有什么。编译器说它找不到您包含在 cpp 中的文件。如果您已正确安装 libconfig,则更改为#include "libconfig.h++"即可#include <libconfig.h++>解决问题。如果它没有帮助,则意味着您的包含路径中没有“libconfig.h++” 。

于 2014-03-23T08:54:19.807 回答