Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 47263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:05:42+00:00 2026-05-10T16:05:42+00:00

I code C++ using MS Dev Studio and I work from home two days

  • 0

I code C++ using MS Dev Studio and I work from home two days per week. I use CVS to keep my sources synchronized between the two computers but there are difference between the environments the machines are in.

Can anyone suggest a way I can conditionally modify constants in my code depending on whether I am compiling on my home box or not ?

What I am after is a way of defining a symbol, let’s call it _ATHOME, automatically so I can do this:

#ifdef _ATHOME #  define TEST_FILES  'E:\\Test' #  define TEST_SERVER '192.168.0.1' #else #  define TEST_FILE   'Z:\\Project\\Blah\\Test' #  define TEST_SERVER '212.45.68.43' #endif 

NB: This is for development and debugging purposes of course, I would never release software with hard coded constants like this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:05:43+00:00Added an answer on May 10, 2026 at 4:05 pm

    On your home and work machines, set an environment variable LOCATION that is either ‘1’ for home or ‘2’ for work.

    Then in the preprocessor options, add a preprocessor define /DLOCATION=$(LOCATION). This will evaluate to either the ‘home’ or ‘work’ string that you set in the environment variable.

    Then in your code:

    #if LOCATION==1   // home #else   // work #endif 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 513k
  • Answers 513k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Answer to second question: Change var box = $(this); to… May 16, 2026 at 5:54 pm
  • Editorial Team
    Editorial Team added an answer CSS transformations with perspective are only possible with Safari at… May 16, 2026 at 5:54 pm
  • Editorial Team
    Editorial Team added an answer Theory On many machines - but not Intel IA32 ones… May 16, 2026 at 5:54 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am currently learning and experimenting with C and am using Bloodshed's DEV-C++ as
Yes, it's a noob question... I have been using Dev-C++ for all my projects
I'm starting a new project using Linux and PHP, but for the early dev
What's up with my Footer CSS ? Using the Web Dev toolbar in Firefox
Background I came from several years working in a company where all the database
I'm trying to get the Registration-Free Activation of COM Components: A Walkthrough sample from
I have used the Attach to process function within VS 2008 many times, but
I am trying to understand the difference between phones, and the software on them.
Is there an easy wayt o capture a keypress (in my case: F5) in
First of all, i'd to establish that i do have the text file in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.