如何编译C++;源代码通过C++; 我们可以用C++编写一个程序,用编译器编译C++源代码吗?

如何编译C++;源代码通过C++; 我们可以用C++编写一个程序,用编译器编译C++源代码吗?,c++,C++,例如,我们有一个程序,它采用文件名,然后进行编译: Enter your C++ source code file name : cppSource.cpp your program compiled. output: cppSource.exe 或: 我并不是说我们要编写编译器。 我的意思是编写一个程序,使用编译器编译cpp文件。 我们如何访问编译器以及如何检测计算机中是否安装了编译器。使用系统函数调用任何可执行文件,例如g++编译器: #include <stdlib.h>

例如,我们有一个程序,它采用文件名,然后进行编译:

Enter your C++ source code file name : cppSource.cpp
your program compiled. 
output: cppSource.exe
或:

我并不是说我们要编写编译器。 我的意思是编写一个程序,使用编译器编译cpp文件。
我们如何访问编译器以及如何检测计算机中是否安装了编译器。

使用
系统
函数调用任何可执行文件,例如g++编译器:

#include <stdlib.h>
int retval = system("g++ file.cpp");

有。是的。。。它在Linux中被称为
make
,如果编译器不存在?
#include <stdlib.h>
int retval = system("g++ file.cpp");
int retval = system("g++ file.cpp > output.txt");