运行C++;Linux中脚本中的文件 我需要一个编译和运行C++文件的代码(我已经用于图像处理),从脚本中说OpenYMCAL.CPP。 有人能帮我吗?

运行C++;Linux中脚本中的文件 我需要一个编译和运行C++文件的代码(我已经用于图像处理),从脚本中说OpenYMCAL.CPP。 有人能帮我吗?,c++,bash,C++,Bash,怎么样 g++ Open_camera.cpp ./a.out 如果您有 // hello.cpp #include <stdio.h> int main() { printf("Hello, world!\n"); return 0; } //hello.cpp #包括 int main(){ printf(“你好,世界!\n”); 返回0; } 你可以写 gcc-o hello.exe hello.cpp 这意味着: 使用gcc编译文件hello.cpp

怎么样

g++ Open_camera.cpp
./a.out
如果您有

// hello.cpp
#include <stdio.h>

int main() {
    printf("Hello, world!\n");
    return 0;
}
//hello.cpp
#包括
int main(){
printf(“你好,世界!\n”);
返回0;
}
你可以写

gcc-o hello.exe hello.cpp

这意味着:

  • 使用gcc编译文件hello.cpp
  • -输出为hello.exe,将所有内容链接到其中

<>注意GCC是GNU编译器集合,如果你传递它的C++文件,它将调用场景下的/++的C++(C++编译器)。如果你知道编译程序的命令和执行它的命令,那么你可以很容易地编写脚本。您遇到了什么问题?您可以编写编译器,也可以使用已经存在的编译器。@Dave我建议您从头开始编写编译器。