打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
4.2.1. Eclipse Managed Build — C/C Software...

4.2.1. Eclipse Managed Build

To begin with, this can be the simplest way to build a new Project.(But it only works with GCC and other Eclipse supported tool-chains.) [1]

CDT gives a GUI to:

With Eclipse managed build, Eclipse can automatically create a set of makefiles. These makefiles can be used with standard make utility. Thus, if the project ismanaged within Eclipse, developers not using Eclipse can still build thesoftware. It is also useful for automated standalone builds.

Note

Older versions of CDT used to refer this as a Managed make project

4.2.1.1. Creating a sample project

  1. Click File ? New ? Project

  2. Select C Project

  3. Name the project as Hello World.

  4. Select project type as Hello World ANSI C Project

  5. Select Tool-chain as MinGW GCC

  6. Click Next button

  7. Input your details

  8. Click Next button

  9. Select Advanced settings

  10. Select Current builder as Gnu Make Builder

  11. Click OK button

  12. Click Finish button

  13. If you get a message to switch perspective, Click Yes

    This happens if the previous perspective was not C/C++ perspective.

This is how the Project Explorer view would look like.

  1. The name of the project HelloWorld
  2. Eclipse would list executables and libraries of the project here.
  3. Eclipse would list include directories and header files here.
  4. Eclipse generated folder. The name is derived from the buildconfiguration.
  5. Eclipse generated Makefiles
  6. The actual source file.

To build the project, do either of:

  • Press Ctrl + B

  • Click Project ? Build All

  • Press the Build Button

4.2.1.2. Build Configuration

Build configurations are different ways of building a code. The most basicwould be Debug mode and Retail Mode. In Debug mode, the generated objectsand executables have Debug symbols. For large projects, this can becomefurther complicated. Including files for test code, excluding files for testcode, etc.

Each configuration can have unique set of source files, includes, #defines,and other compiler/linker parameters.

4.2.1.3. Changing Build Settings

Eclipse gives control over how the project gets build.

4.2.1.3.1. Include / Exclude Files from Build

Use Right Click ? Resource Configuration ? Exclude FromBuild to add/remove a source file from a Build Configuration

Even finer control can be achieved through, Project ?Properties ? C/C++ General ? Paths and Symbols ? Source Location (SeeIncluding / Excluding files & directories from build)

Including / Excluding files & directories from build

4.2.1.3.2. Compiler Directives

Through Project ? Properties ? C/C++ General ? Pathsand Symbols ? Includes we can Add include paths to build.

Add include paths to build

Through Project ? Properties ? C/C++ General ? Pathsand Symbols ? Symbols we can Add compiler defines to build.

Add compiler defines to build

4.2.1.3.3. Change the Make Utility

To Change the default build utility, from make to somethingelse, go to Project ? Properties ? C/C++ Build ?Builder Settings

Change the default build utility

To change Advanced build settings , e.g. using Paralleljobs for build (-j), or build on every save, go to Project? Properties ? C/C++ Build ? Behaviour

Advanced build settings

4.2.1.3.4. Advanced toolchain specific settings

The tool-chain can be selected form Project ? Settings ?C/C++ Build ? Tool Chain Editor.

To Change general settings of the Tool-Chain, like, enable warnigns(-Wall), don’t include standard system header files during compilation(-nostdinc), etc. go to Project ? Settings ? C/C++Build ? Settings ? Tool Settings

Change general settings of the Tool-Chain

We can also Change the build artifacts (dll/lib/exe). We can control if wewant to build a DLL/Shared Object, static library, or an Executbale out ofthis project.

Change the build artifacts (dll/lib/exe)

4.2.1.3.5. Pre-Build and Post-Build Steps

To Add pre-build and post-build steps, go to go to Project ?Settings ? C/C++ Build ? Settings ? Build Steps

Add pre-build and post-build steps

[1]Cygwin GCC, Linux GCC, MacOSX GCC, MinGW GCC, Solaris GCC aresupported by default. The Proprietary distributions based onEclipse would also support the toolchains of that distribution.
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
eclipse添加c/c++的lib(lpthread)
eclipse CDT Unresolved inclusion 错误解决办法
eclipse 编译jni的一些设置
linux 调试动态库
Windows环境下搭建基于Eclipse的STM32 GCC 开发环境(三)调试篇
装了eclipse的C/C++版本,请问该如何配置Cross GCC path and prefix
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服