本文介绍了帮助编译gcc / g ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个目录结构,如下面的树,我的g ++命令应该是什么样子将成功编译在。tagpp / bin目录中的.cpp文件,所有我的.h文件坐在taglib / include / taglib目录。

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.

任何人的帮助将非常感谢。
谢谢!

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


推荐答案

-I -L 选项分别指定包含和库的搜索目录。因此,你的命令应该是这样的:

The -I and -L options specify search directories for includes and libraries respectively. Therefore, you command should be something like:

g ++ -o< xyz> taglib / bin / *。cpp -Iinclude / taglib -Llib

man gcc 甚至 gcc --help 提供了关于这些特定命令行选项的大量信息(和GCC手册也相当友好)。你应该真的在尝试他们之前,你问这里 - 它是更有效率(无需等待答案!)。

man gcc and even gcc --help gives great information on these particular command line options (and the GCC manual is fairly friendly too). You should really be trying them first before you ask here - it's more efficient (no waiting for answers!).

这篇关于帮助编译gcc / g ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 18:58