linux下如何编译多个cpp文件,并且所包含的头文件在另一个文件包里
迷茫
迷茫 2017-04-17 16:18:24
0
3
824

我尝试在linux下编译别人写好的c++文件包,它的目录结构是这样的。

其中c++文件全部放在src里面。hpp文件全部放在include里面

当我用下面的命令去编译它的时候,发现他报如下的错误
我应该执行怎样的命令才能使它两个文件的内容都编译到?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(3)
大家讲道理

-ISet the include path. -I设置include路径。

例如src和include同级,你在src目录下编译,加-I "../include"

For example, if src and include are at the same level, you compile in the src directory and add -I "../include". Then you find that there are more dependencies, so you keep adding them. 🎜
Peter_Zhu

Just add the relevant paths to cmake

黄舟

Write a Makefile directly. Isn’t compilation much more convenient? ! !

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!