有没有一种方法可以自动链接并编译g++中所有需要的文件

Is there a way to automatically link and compile all the required files in g++

本文关键字:g++ 编译 文件 链接 一种 方法 有没有      更新时间:2024-09-22

我是C++的新手,假设我有三个文件main.cpptest.cpptest.hmain.cpp文件包括test.h头文件。

现在,为了成功编译文件,我使用以下命令:

g++ main.cpp test.cpp -o main.exe

有没有办法只提供main.cpp,编译器会自动编译所有需要的文件?

谢谢。

如果你使用的是vs代码,你可以通过微软下载c/c++扩展,然后点击f6,它会编译你目录上的所有.cpp文件,并添加f3来帮助你,这将增加超级能力并允许它飞行。bc红牛给你翅膀