[英]Help compiling with gcc/g++
If I have a directory structure such as the tree below, what should my g++ command look like that would successfully compile the .cpp file that is in the taglib/bin dir, with all my .h files sitting in the taglib/include/taglib directory. 如果我有一个目录结构,如下面的树,我的g ++命令应该是什么样的,它会成功编译taglib / bin目录中的.cpp文件,所有我的.h文件都位于taglib / include / taglib中目录。
Anyones help would be greatly appreciated. 任何人的帮助将不胜感激。 Thank you!
谢谢!
-taglib
--bin
.cpp file is here, incl headers are like this: #include <other.h>
but wondering if it should be #include </taglib/include/taglib/other.h>,
also, this should be where my binary will live when compiled.
--lib
all my .so files live here
--include
---taglib
all my .h files live here
The -I
and -L
options specify search directories for includes and libraries respectively. -I
和-L
选项分别指定包含和库的搜索目录。 Therefore, you command should be something like: 因此,您的命令应该是这样的:
g++ -o <xyz> taglib/bin/*.cpp -Iinclude/taglib -Llib
man gcc
and even gcc --help
gives great information on these particular command line options (and the GCC manual is fairly friendly too). man gcc
甚至gcc --help
提供了有关这些特定命令行选项的大量信息(而且GCC手册也相当友好)。 You should really be trying them first before you ask here - it's more efficient (no waiting for answers!). 您真正应该在尝试之前先尝试它们-效率更高(无需等待答案!)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.