简体   繁体   English

用g ++递归制作.O文件?

[英]Recursivly make .O files with g++?

I have my main.cpp file, and in that folder is another folder called src, and in that folder are more folders etc... How could I compile this easily with g++? 我有main.cpp文件,并且在该文件夹中还有一个名为src的文件夹,并且在该文件夹中还有更多文件夹,等等。如何使用g ++轻松编译此文件? I do not want to make a make file at this time because I'm still working on my project but I want to test in in Linux and OSX. 我现在不想制作一个make文件,因为我仍在从事我的项目,但是我想在Linux和OSX中进行测试。

Thanks 谢谢

g++ doesn't manage your build process. g++不能管理您的构建过程。 It follows the unix philosophy of doing one thing and doing it well. 它遵循做一件事情并做好事的unix哲学。 This doesn't include build management. 这不包括构建管理。

Make a Makefile. 制作一个Makefile。 Its what they are made for. 它是做什么的。

您可以使用Makefile或通过在每次构建时列出一个列表来正确执行此操作,例如:

g++ -Wall -o myapp `find . -name \*.cpp`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM