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 910317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:01:27+00:00 2026-05-15T17:01:27+00:00

This is what I’m trying to do: $ c++ -D GENERATED=build/generated-content main.cpp My main.cpp

  • 0

This is what I’m trying to do:

$ c++ -D GENERATED=build/generated-content main.cpp

My main.cpp file:

#include "GENERATED/header.h"
void f() { /* something */ }

Currently this code fails to compile. How should I fix it? And whether it’s possible at all?

  • 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. Editorial Team
    Editorial Team
    2026-05-15T17:01:27+00:00Added an answer on May 15, 2026 at 5:01 pm

    It seems you want to use different headers depending on some “compilation profile”.

    Instead of the -Dsolution, I would rather suggest using the -I directive to specify the include directories.

    Given you have the following file tree:

    /
      debug/
        header.h
      release/
        header.h
    

    main.cpp:

    #include "header.h"
    
    /* some instructions, not relevant here */
    

    And in your Makefile (or whatever tool you use), just specify the proper include directory to use, depending on whatever reason you want:

    g++ -I debug main.cpp // Debug mode
    
    g++ -I release main.cpp // Release mode
    

    Important foot note: I don’t know if you intended to use this as a debug/release switch. However, doing so would be weird: the interface (the included .h files) shouldn’t change between release and debug. If you ever need this, the usual way is to enable/disable some parts of the code using defines, mostly in .c (and .cpp) files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This is my code: <CheckBox android:id=@+id/sprint_checkbox android:layout_width=fill_parent android:layout_height=wrap_content android:text=@string/sprint_game /> <CheckBox android:id=@+id/marathon_checkbox android:layout_width=fill_parent android:layout_height=wrap_content
This code below allows me to find the word error in all my files
This is my sample code: SPWeb web = SPContext.Current.Web SPList list = web.Lists[TestList]; try
This is the file auth.txt (username password) paolo 1234 luca 0000 marci 1000 And
This code won't compile because there is an illegal reference to a static field.
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
This is an example of the code am using. I use a modified version
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am trying to render a haml file in a javascript response like so:

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.