DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • How to Build Your Own AI SRE From Scratch
  • Stop Preparing for Audits — Build the Pipeline That Audits Itself
  • Multi-Agent Software Engineering: Can AI Teams Build Production Systems?
  • Arm64 Is No Longer the Edge Case

Trending

  • OpenCode: Setting Up an Open-Source AI Coding Assistant
  • To Switch, or Not to Switch the AI Model
  • How You Clear Your HTML5 Canvas Matters
  • Part 2: Securing and Scaling Goose-to-Java Agent Traffic With agentgateway

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Coding
  3. Frameworks
  4. Eclipse Build Variables

Eclipse Build Variables

By 
Erich Styger
·
Dec. 25, 13 · Interview
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
29.0K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

this post is not about variables in my application code (which i debug). it is about using variables in eclipse for building projects. eclipse variables allow me to make my projects ‘position independent’ whenever i cannot use a path relative to my projects or workspace.

eclipse variables

which variables are used where in eclipse might be sometimes not very clear. depending in which context variables are used, not everything might be available. this link for example gives a list of variables which can be used to invoke an external tool.

build variables

eclipse comes with many built-in variables, especially for the build system. if i want to see what variables are already defined, i can show them in the project properties, under c/c++ build > build variables with enabled option ‘show system variables’:

system build variables

system build variables

with the ‘add…’ button i can define and add my own variables, available for that project:

define a new build variable

define a new build variable

if above operation is done on a project, then the setting is for the project only. if i want to add a variable for the workspace, i can do this using the menu window > preferences :

workspace build variables

workspace build variables

global system variables

eclipse automatically includes the system (e.g. windows) environment variables. many dialogs have the ‘variables…’ button where i can use my variables, including the variables defined on system level:

system variables

system variables

system variables: one way or the other

so if i want to have a variable for every workspace, one way is to define it at the system level. however, this is not a good way as this clutter the variables for every application.

batch file

a solution to this to create my custom batch file where i define my variables, and at the end of this batch file i launch eclipse. that way the extra variables are only for this eclipse session.

cwide-env file

another very nice way codewarrior eclipse offers is using the cwide-env file located in the eclipse sub-folder of the installation:

cwide-env file

cwide-env file

i can define variables here, or extend existing ones:

  • -add : add string to the variable at the end
  • -prepend : add string to the variable at the beginning

that way i can easily manipulate existing system variables or create new ones which then are used by eclipse.

summary

variables in eclipse help me to define paths to source files and folders outside of a project or workspace. with variables i avoid using absolute paths which would make porting projects from one machine to another difficult. i can define variables for projects, for the workspace or use system variables. with codewarrior i have a cwide-env file which is used to extend the system variables.

happy variabling :-)

Eclipse Build (game engine)

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

Opinions expressed by DZone contributors are their own.

Related

  • How to Build Your Own AI SRE From Scratch
  • Stop Preparing for Audits — Build the Pipeline That Audits Itself
  • Multi-Agent Software Engineering: Can AI Teams Build Production Systems?
  • Arm64 Is No Longer the Edge Case

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook