Jon*_*nas 16 c++ eclipse configuration mingw eclipse-cdt
我想在Windows上使用Eclipse和CDT插件进行一些C++开发.我使用Eclipse Helios SR1并安装了CDT插件.我还安装了MinGW,现在我在Eclipse中编写了一个简单的"Hello World".
HELLO.CPP
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World" << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在Eclipse中使用CDT插件和MinGW编译器.我该如何编译我的程序?我如何在Eclipse中测试运行程序?
小智 5
在浏览了许多主题和文章后,我找到了一个解决方案。解决方案在 Eclipse Neon.3 Release (4.6.3) 上的 Windows 10 x64 上测试,使用 C/C++ 开发工具 9.2.1.201704050430 和 MinGW
系统配置
C:\MinGW(实际上是到C:\,因为存档包含文件夹MinGW)This PC-> Properties-> Additional system settings-> Tab Advanced-> ButtonEnvironment variablesSystem variables点击New。命名变量MINGW_HOME并将路径设置为 MinGW 安装文件夹C:\MinGW,然后OKPath在表中查找变量并选择EditNew并键入%MINGW_HOME%\bin\OK在打开的窗口中通过 clickig 确认操作g++ --version您应该看到类似g++ (GCC) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Eclipse CDT 配置
C:\MinGW\bin\)。制作文件的副本gcc.exe(不要重命名原始文件!)mingw32-gcc.exe(你应该有两个文件gcc.exe,并mingw32-gcc.exe在\MinGW\bin\)C\C++透视图Window-> Preferences-> C\C++-> Build->EnvironmentAdd并键入PATH名称,然后单击Variables并选择Path。用 确认Ok。PATH单击Select,然后单击选择新变量Ok。现在您应该可以编译 Hello World 程序了。只需选择New-> C++ Project。在这里你应该看到可用的 MinGW 作为工具链