eclipse配置c开发环境

1 eclipse配置c开发环境

 

1.1 缘起

公司同事需要开发c语言,想要配置一个开发环境,考虑使用eclipse+cygwin gcc开发,因 此帮着配置了开发环境。机器配置:win10,4G。

首先,Windows下用eclipse玩c用到一下三个东西:

  1. cygwin(Windows平台的unix模拟程序,包含了gcc和g++)
  2. eclipse

1.2 cygwin

cygwin搜索官方网站下载安装程序,选择64位的,打开安装程序setup-x86_64.exe,然后选 install from internet,接着选择存放位置,打开翻_墙(不翻_墙下载会很慢),进入下载列 表,这个列表就是要求你下载什么程序的列表,请务必安装以下程序,务必安装: gcc-core,gcc-g++,make,gdb,binutils;可以参考: http://www.linuxidc.com/Linux/2011-06/37588.htm

将cygwin安装目录\bin加入到环境变量PATH中。好了,开个cmd命令行窗口,分别试一下gcc -v, make -v,gdb -v命令。

$ gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/lto-wrapper.exe
目标:x86_64-pc-cygwin
配置为:/cygdrive/i/szsz/tmpp/gcc/gcc-5.4.0-1.x86_64/src/gcc-5.4.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-5.4.0-1.x86_64/src/gcc-5.4.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible
线程模型:posix
gcc 版本 5.4.0 (GCC) $ make -v
GNU Make 4.2.1
为 x86_64-unknown-cygwin 编译
Copyright (C) 1988-2016 Free Software Foundation, Inc.
许可证:GPLv3+:GNU 通用公共许可证第 3 版或更新版本<http://gnu.org/licenses/gpl.html>。
本软件是自由软件:您可以自由修改和重新发布它。
在法律允许的范围内没有其他保证。 GNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".

1.3 eclipse

先安装jdk1.8,在eclipse官网下载c++开发ide,eclipse-cpp-neon-1-win32-x8664,打开 eclipse,win10下报错:could not create the Java Virtual Machine,经过查找发现找 不到jdk路径,可能是win10的问题,因此对eclisp根目录下的eclipse.ini进行修改:

-startup
plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.400.v20160518-1444
-product
org.eclipse.epp.package.cpp.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m

在最前面加上路径

-vm
c:\Programs\jdk1.8\bin
-startup
plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.400.v20160518-1444
-product
org.eclipse.epp.package.cpp.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m

1.4 配置

新建一个c项目,选择cygwin gcc,建立c工程,项目右键Properties->C/C++, Build->toolchain 中确定:

Current toolchain = Cygwin Gcc
Current builder = Gnu Make Builder Used tools 有:
GCC Assembler,
GCC Archiver,
Cywgin C++ Compiler,
Cywgin C Compiler,
Cywgin C Linker,
Cywgin C++ Linker。 最后将Display compatible toolchains only选中

按理来说这个时候点击运行就可以编译链接程序了,但是出现错误,但这里只会编译链接, 但不会运行,也不会调试程序,我们还得手动做个简单的配置:

进入debug configuration对话框,选择C/C++application->test debug,点击Browse…按 钮,选择选择刚才编译出来的exe文件,debug/test.exe,在点击run或debug按钮,ok了。

Created: 2016-10-11 周二 12:34

Emacs 25.1.1 (Org mode 8.2.10)

Validate

eclipse配置c开发环境的更多相关文章

  1. Eclipse配置Flex开发环境(转)

    Eclipse配置Flex开发环境 开发环境:Eclipse3.2.Flex Builder31.下载安装Flex Builder3,下载地址:http://subject.csdn.net/adob ...

  2. Eclipse配置Maven开发环境

    前言: 现在Eclipse版本越来越高.高版本的Eclipse甚至已经集成了Maven像是SpringSource的哪个版本.用习惯了Eclipse.在开发中还是不想更换掉自己的IDE.如此一来就又了 ...

  3. 【SpringBoot】(1)-- 基于eclipse配置springboot开发环境

    基于eclipse配置springboot开发环境 1. 下载并配置eclipse ① 前往eclipse官网 https://www.eclipse.org/downloads/packages/ ...

  4. Eclipse配置安卓开发环境(解决SDK manager下载慢问题)

    Android新手在eclipse搭建安卓开发环境基本都会遇到Android SDK manager下载慢,ADT下载慢的问题,本文将带大家完整的安装一遍开发环境 工具:eclipse     SDK ...

  5. eclipse配置PHP开发环境

    下载 http://www.oracle.com/technetwork/java/javase/downloads/index.html下载JDK,Eclipse 安装需要JDK环境:http:// ...

  6. eclipse 配置scala开发环境

    最近在学习spark相关知识.准备搭建eclipse开发环境.在安装过程中遇到的问题记录下来. 首先在scala网站上下载了scalaIDE:http://scala-ide.org/download ...

  7. Mac中Eclipse配置Maven开发环境

    1.下载Maven tar.gz包 http://maven.apache.org/download.cgi 2.解压tar包 随便一个路径都行 3.配置环境变量 bash设置~/.bash_prof ...

  8. python函数,模块及eclipse配置python开发环境

    一.eclipse的使用 1.作用 (1)最好用的IDE (2)可调式debug (3)查看可执行过程 (4)可查看源代码 2.安装eclipse及配置 目录安装Pythonpython for ec ...

  9. eclipse配置ant开发环境,一键部署项目

    ANT出现之前,编译和部署Java应用需要使用包括特定平台的脚本.Make文件.不同的IDE以及手工操作等组成的大杂烩.现在,几乎所有的开源Java项目都在使用Ant,许多公司的开发项目也在使用Ant ...

随机推荐

  1. 【转】C#多线程示例

    using System; using System.Threading; namespace ConsoleThread { class ThreadApp { static int interva ...

  2. 几种常见算法js

    没有系统地总结过js算法,虽然在项目中陆陆续续的也用过好多算法,有一次去一家公司面试的时候,面试官说想谈谈算法,有点懵了,所以接下来的面试中谈的也有点被动,避免下次再碰到这种情况,今天决定好好的总结下 ...

  3. PHPnow在win8下安装失败的解决办法

    提示: 安装服务[ Apache_pn ]失败,可能原因如下:1.服务名已存在,请卸载或使用不同服务名.2.非管理员权限,不能操作Window NT服务. 解决方案: 搜索:命令提示符   , 右键以 ...

  4. 解决表单(搜索框)回车的时候直接提交了表单不运行js的问题

    我想在搜索输入框中输入关键词后回车,先运行一段js,然后在提交表单,而默认情况下回车的时候也会出发表单的提交所有没法等js运行完成,故利用 onkeydown="if(event.keyCo ...

  5. 附加数据库失败,操作系统错误 5:"5(拒绝访问。)"的解决办法

    无法打开物理文件 XXX.mdf".操作系统错误 5:"5(拒绝访问.)". (Microsoft SQL Server,错误: 5120)   找到xxx.MDF与xx ...

  6. test latex1

    equation systems: \begin{equation} 1 + 2 = 3 \ 1 = 3 - 2 \end{equation} align text \begin{align} 1+2 ...

  7. C++构造函数与虚表覆盖

    在涉及到虚函数的情况下,C++构造函数的构造顺序为:先调用构造函数,虚表指针初始化,用户代码:如涉及到多重继承情况,初始化顺序为基类.子类(从左至右),假设一个类的继承情况如下图,其初始化顺序为:Po ...

  8. SSL/TLS协议运行机制

      转载自http://www.ruanyifeng.com/blog/2014/02/ssl_tls.html 互联网的通信安全,建立在SSL/TLS协议之上. 本文简要介绍SSL/TLS协议的运行 ...

  9. 周末发现一个BUG,时有时无,一出程序就崩溃,郁闷了好久,终于跟出来来了,记之,提醒自己今后一定规范编写,只要规范,绝对不会出问题

    -- :::] cell0 create -- :::] *** Assertion failure /UITableView.m: -- :::] [ Uncaught Exception ] Na ...

  10. fail to create java virtual machine..

    今天打开zend stdio 的时候 出现的错误  fail to create java virtual machine... 然后找度娘了,,都说改xxxxx, 我打开360  ,把内存清理了一遍 ...