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

  • Home
  • SEARCH
  • 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 208k
  • Answers 208k
  • 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 Try adding a parameter to the CSS file URL: mystyles.css?12345… May 12, 2026 at 9:28 pm
  • Editorial Team
    Editorial Team added an answer You are printing the bytes out using %c as the… May 12, 2026 at 9:28 pm
  • Editorial Team
    Editorial Team added an answer What you're trying to do won't work at all. When… May 12, 2026 at 9:28 pm

Related Questions

I've used HashSet and Dictionary a lot in C#, and found them very fast...
After looking at another question on SO ( Using NaN in C++ ) I
Background: I am writing a C++ program working with large amounts of geodata, and
I just reorganized the code for a project and now I'm getting errors I

Trending Tags

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

Top Members

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.