简体   繁体   English

使用Eclipse CDT配置MinGW

[英]configure MinGW with Eclipse CDT

I have searched a lot about this and read most of the available answers for similar problem but I still couldn't solve it. 我已经搜索了很多关于这个并且阅读了类似问题的大部分可用答案,但我仍然无法解决它。 Therefore, any help will be helpful. 因此,任何帮助都会有所帮助。

I am using Eclipse Mars(Latest version after Luna) on Windows 7 我在Windows 7上使用Eclipse Mars(Luna之后的最新版本)

MinGW is installed in "C:\\Program Files (x86)\\CodeBlocks\\MinGW\\bin". MinGW安装在“C:\\ Program Files(x86)\\ CodeBlocks \\ MinGW \\ bin”中。

Environment variable "Path" contains "C:\\Program Files (x86)\\CodeBlocks\\MinGW\\bin;..." 环境变量“Path”包含“C:\\ Program Files(x86)\\ CodeBlocks \\ MinGW \\ bin; ...”
Preferences -> C/C++ -> Build -> Settings -> Discovery->CDT GCC Built-in Compiler Settings : command to get compiler specs 首选项 - > C / C ++ - >构建 - >设置 - >发现 - > CDT GCC内置编译器设置:命令获取编译器规格
${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}" $ {COMMAND} $ {FLAGS} -E -P -v -dD“$ {INPUTS}”
manually doing gcc -E -P -v -dD in cmd from any directory gives 从任何目录中的cmd手动执行gcc -E -P -v -dD
.
.
Target: mingw32 . 目标:mingw32。
.

Errors: 错误:

Program g++/gcc not found in PATH 在PATH中找不到程序g ++ / gcc

I make a C++ project, add a file with hello world program in it. 我制作一个C ++项目,在其中添加一个包含hello world程序的文件。

I get errors "unresolved inclusion " and 'printf' could not be resolved. 我得到错误“未解决的包含”和'printf'无法解决。

comment if any other details required 评论是否需要任何其他细节

It sounds like you're doing everything correctly. 听起来你正确地做了一切。

TWO SUGGESTIONS: 两个建议:

  1. Take a look at this link, and see if you missed anything regarding the MinGW/GCC install: 看一下这个链接,看看你是否错过了有关MinGW / GCC安装的任何内容:

    https://www3.ntu.edu.sg/home/ehchua/programming/howto/EclipseCpp_HowTo.html https://www3.ntu.edu.sg/home/ehchua/programming/howto/EclipseCpp_HowTo.html

  2. Otherwise, consider deleting (or simply renaming) your current Eclipse and installing the CDT (Eclipse for C/C++ Developers) version instead: 否则,请考虑删除(或简单地重命名)当前的Eclipse并安装CDT(Eclipse for C / C ++ Developers)版本:

    http://www.eclipse.org/downloads/ http://www.eclipse.org/downloads/

  3. For whatever it's worth, here are a couple of screenshots from my property settings (I'm able to create and successfully build a new C project): 无论它的价值如何,这里有一些来自我的属性设置的截图(我能够创建并成功构建一个新的C项目):

在此输入图像描述

在此输入图像描述

I think your problem is simply because of MinGW path include white spaces in it. 我认为你的问题仅仅是因为MinGW路径中包含空格。 just reinstalling MinGW on Root directory "c:\\MinGW"will solve your problem. 只需在根目录“c:\\ MinGW”上重新安装MinGW就可以解决您的问题。 install MinGW with basic setup packages select "mingw-developer-toolkit, mingw32-base, mingw32-gcc-g++, msys-base". 使用基本安装包安装MinGW,选择“mingw-developer-toolkit,mingw32-base,mingw32-gcc-g ++,msys-base”。 complete installation. 完成安装。 restart your pc. 重启你的电脑。 then check your eclipse settings. 然后检查你的日食设置。 I hope your problem is already solved. 我希望你的问题已经解决了。

I also faced such problems,you need to set environment variable, In path add your MinGW location, if you haven't downloaded MinGW go here for downloading MinGW: http://sourceforge.net/projects/mingw/files/latest/download?source=files 我也遇到过这样的问题,你需要设置环境变量,在路径中添加你的MinGW位置,如果你没有下载MinGW去这里下载MinGW: http//sourceforge.net/projects/mingw/files/latest/download ?源=文件

Simple solution is: 简单的解决方案是

在此输入图像描述

For more and detailed information to fix your problem, it worked for me! 有关更多详细信息以解决您的问题,它对我有用!

Visit here: 访问这里:

http://www.multigesture.net/articles/how-to-install-mingw-msys-and-eclipse-on-windows/ http://www.multigesture.net/articles/how-to-install-mingw-msys-and-eclipse-on-windows/

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

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