zoukankan      html  css  js  c++  java
  • 转:Configure your eclipse for C++

    from: http://omtlab.com/configure-your-eclipse-for-c/

    Configure your eclipse for C++

    This is small sample of how to use eclipse for c++.

    There are two ways to use eclipse for C++.

    1) Download Eclipse CDT : It is separate eclipse only for C/C++.
    2) Download C++ Plugin in you existing eclipse.

    I recommend you to download separate Eclipse CDT.

    Download from here : http://www.eclipse.org/cdt/

    After downloading eclipse CDT you need to download C++ compiler.

    I am using MinGW compiler with eclipse. There are some other compiler like : cygwin

    You need to install MinGW compiler in your pc.
    Download MinGW from here : http://www.mingw.org/

    After installing MinGW you need to set environment variable (MINGW_HOME) in you pc.

    Name of variable is MINGW_HOME and set MinGW install directory as a path (Example : C:MinGW).

    All are set and now you can open your eclipse CDT.

    Create new C++ project.

    Goto File > New > C++ Project.

    Create New C++ Project

    Small popup will open. Enter below details in it.

    1) Enter your project name.
    2) Select Project Type : Hello World C++ Project.
    3) Select Toolchains: MinGW GCC.

    Enter C++ Project Details

    Click on Next,Next and Finish.

    Now final step before build your hello world project.

    Right Click on your project and click on Properties.

    Select Project Properties

    Goto Project > Properties > C/C++ Build > Settings > Tool Settings (Tab) > MinGW C++ Linker (Option) > Add Command (g++ -static-libgcc -static-libstdc++) (default command is only g++)

    Add Linker Command

    Right click on your project select Build Project option.

    It will generate some output in console.

    23:43:15 **** Rebuild of configuration Debug for project omtcppexample ****
    Info: Internal Builder is used for build
    g++ -O0 -g3 -Wall -c -fmessage-length=0 -o “src\omtcppexample.o” “..\src\omtcppexample.cpp”
    g++ -static-libgcc -static-libstdc++ -o omtcppexample.exe “src\omtcppexample.o”

    23:43:17 Build Finished (took 1s.596ms)

    Again Right Click on your project and Run as > Local C/C++ Application.

    Output :
    !!!Hello World!!!

  • 相关阅读:
    第10组 Beta冲刺 (4/5)
    第10组 Beta冲刺 (3/5)
    第10组 Beta冲刺 (2/5)
    第10组 beta冲刺(1/5)
    软工实践个人总结
    第01组 每周小结(3/3))
    第01组 每周小结(2/3)
    第01组 每周小结 (1/3)
    第01组 beta冲刺总结
    第01组 beta冲刺(5/5)
  • 原文地址:https://www.cnblogs.com/jhj117/p/6121783.html
Copyright © 2011-2022 走看看