How do I set up C/C++ on Eclipse in Windows?

对着背影说爱祢 提交于 2019-12-18 09:34:19

问题


I just did the default Java (8) installation of Eclipse on my Windows (8, yikes) laptop, and it seems to work just fine. However, I'm not as good at Java as I am with C and C++, and for some work it's more expeditious to use C/C++ than Java.

Unfortunately, the Eclipse installer for Windows doesn't make it very easy to set up Eclipse for C/C++. It looks like I'd be fine with Linux or BSD, but then I'd have to scrounge up another laptop (because I need the mobility) and install Linux or BSD on it. Yes, I need to leave Windows on this machine, so Windows hate isn't going to help me.

My lazy web search turned up this article: "Install Eclipse for C++ Development on Windows 7 64-bit". Is there a better installation guide than that, or does anyone care to describe the process in more detail?


回答1:


Even though you have CDT features installed, you need to install a GCC compiler for windows such as MinGW or Cygwin. Once you install them, add the 'bin' folder in the installed path to the environment variables and then restart eclipse. You should now see MinGW compiler when you select "Create new C Project". After this step, proceed with your C programs and this should resolve your problems.




回答2:


You will have to install a GCC compiler in your PC and then link it to the project each time you create a project. This can be done while you create a new project, or even after you have done so. You can download MinGW compiler through the following link https://sourceforge.net/projects/mingw/files/latest/download?source=files

Once you have downloaded the compiler and installed it, it can be linked through the following steps:
i. While creating a new project, choose MinGW GCC compiler in the tool chains.

ii. Once you have finished creating a project, go to Project->Properties.

iii. Look for Run/Debug Settings in the left panel.

iv. Click on the New tab and select C/C++ Application.

v. Look for Environment option.

vi. Click on the New tab.

vii. Type "PATH" in the Name bar and fill the Value bar with the path of the compiler. For me, its C:\MinGW\bin.

vii. Click on OK and you are done!




回答3:


The instructions you link to have you install Eclipse IDE for C/C++ developers which will work fine to get a C/C++ development environment up.

If you would instead like to use your EXISTING installation of Eclipse and add C++ Development Tooling (CDT) you can launch Eclipse and then use Install New Software to install the C/C++ Development Tools



来源:https://stackoverflow.com/questions/25753541/how-do-i-set-up-c-c-on-eclipse-in-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!