Over a million developers have joined DZone.

Preprocessor Listing With GNU ARM Eclipse Plugins

DZone's Guide to

Preprocessor Listing With GNU ARM Eclipse Plugins

How to troubleshoot issues with C/C++ preprocessors with a compiler preprocessor listing.

· IoT Zone
Free Resource

Cisco IoT makes digital transformation a reality in factories, transportation, and utilities. Learn how to start integrating with Cisco DevNet.

In case there are problems with the C/C++ preprocessor, it is useful to generate the compiler preprocessor listing. Here is how to create a preprocessor listing with GNU gcc compiler and the GNU ARM Eclipse plugins in Eclipse:

Image title

Preprocessor Listing in Eclipse

In the project settings, turn on the -E option (Preprocess only):

Image title

Preprocessor -E Option

That option will direct the compiler to do preprocessing only, and to stop after that (i.e. not producing object files). Typically, I select that option for the whole project, but of course I can do that for a single file too.

Make sure that the file for which you need the preprocessing is compiled: touch the file or do a Project > Clean to force a full rebuild.

This will just do the preprocessing and produce the preprocessing listing files. Because no object files are generated, linking will fail.

There is one trick to know about it: the preprocessed files produced have the .o (like object files) extension:

Image title

Preprocessor listing file but with object file extension

Open the file with the text editor:

Image title

Open with text editor

Now I can see what the listing is:

Image title

Preprocessor listing

At the end, to not forget to remove the -E option and to do a Project > Clean again to build the project as usual.

Cisco is a software company. Surprised? Don’t be. Join DevNet to explore APIs, tools, and techniques that developers are using to add collaboration, IoT, security, network priority, and more!

iot ,gnu ,eclipse ,arm

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}