Eclipse CDT在Linux下的常见问题

几个Eclipse CDT发生在Linux下的常见问题:

1.安装。

1.推荐到eclipse.org上下载Eclipse IDE for C/C++ Developers (includes Incubating components)这个版本,解压后即可运行。

2.如果不能运行,还要注意机器上安装好jdk,一般来说ubuntu的机器上面都带有open-jdk可供使用。一般情况下足够使用了,如果对于性能还要有更高的要求,推荐到oracle官网下载jdk。

3.对于Gentoo使用者来说,运行命令emerge -av oracle-jdk-bin查看一下依赖关系是否都满足,还要额外地到oracle官网下载jdk安装包并放入/usr/portage/distfiles中方可安装。

4.安装好以后运行命令:java -version查看当前系统正在使用的jdk版本,如果显示为

java version “1.6.0_22”
OpenJDK Runtime Environment (IcedTea6 1.10.4) (Gentoo build 1.6.0_22-b22)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

说明当前使用的时openjdk,若要切换,运行命令java-config -L 查看当前机器上面可用的jdk

The following VMs are available for generation-2:
*) IcedTea6-bin 1.10.4 [icedtea6-bin]
2) Oracle JDK 1.7.0.2 [oracle-jdk-bin-1.7]

运行命令

java-config -S 2设置系统的jdk为2号

再次运行命令java -version 则显示

java version “1.7.0_02”
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)

切换成功。

2.新建了个项目,在运行时出现“launch failed,binary not found”

报错是因为没有指定编译器。

方法一:去Window->Preferences->C/C++->New CDT project wizard->Makefile Project下,找到 Binary Parser 取消 Elf Parser 改选 PE Windows Parser。或是其他编译器,看具体情况而定,当然你也可以指定GNU ELF Parser。

方法二:去projrct -> properties -> c/c++ build -> settings ->Binary Parser下设置一下,比如使用GNU Elf Parser

3.第一次新建工程时遇到makefile的错误

具体解决办法是在新建工程的时候,选择Makefile Project->Next->Advanced settings,勾选generate Makefiles automatically。

4.include提示“Unresolved inclusion“,但编译正常

打开 Windows–>Preferences–>C/C++–>Build–>Environment增加Environment variables to set

添加

Name: CPLUS_INCLUDE_PATH

Value: /usr/include/c++/4.6 (gcc的版本号)

 

5. 想查看eclipse CDT 的include 文件路径


6.Eclipse ->save could not be completed

window->Preferences/General—>Editors–>File Assosiations右边content  Type  —>Java source file

下边Default Encoding   设为uft-8

1 Comment

Ralph says:

Ralph

Eclipse CDT在Linux下的常见问题 | Definite

Leave a Reply to Ralph Cancel Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax