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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:09:16+00:00 2026-06-09T15:09:16+00:00

Using Visual Studio on a Qt project (with the Qt addon), seems to always

  • 0

Using Visual Studio on a Qt project (with the Qt addon), seems to always throw up an error message:

error C2001: newline in constant

From the following line:

this->setApplicationVersion(QString(BUILD_VERSION));

or whenever I use a compiler constant defined in my QMake file. BUILD_VERSION is defined in my QMake build recipe, compiling the project works successfully if I use a different IDE (even when I use the same MSVC compiler, everything works).

I imagine I’m either missing a preference in the Qt addon or inside Visual Studio, or I need to redefine my constant’s outside of my QMake files etc…

The constant is defined and picked up by Intellisense as:

#define BUILD_VERSION \"0.1.0\"

Found the issue is down to escaping the quotes in the constant, in Visual Studio this won’t work but it will work with Mingw, and the MSVC compiler on the command line. Defining constants without the escaping works with Visual Studio:

#define BUILD_VERSION "0.1.0"

The problem is to define the constants in the QMake file, I need to escape like:

#define BUILD_VERSION \\\"0.1.0\\\"

Is there a way to define them in the QMake file and keep them working with Visual Studio?

  • 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-06-09T15:09:17+00:00Added an answer on June 9, 2026 at 3:09 pm

    consider writing

    this->setApplicationVersion( QString( TO_STRING( BUILD_VERSION ) ) );
    

    where TO_STRING converts a something to string:

    #include <iostream>
    using namespace std;
    
    #define TO_STRING_AUX( x )  #x
    #define TO_STRING( x )      TO_STRING_AUX( x )
    
    #define BUILD_VERSION 0.1.0
    
    int main()
    {
        cout << TO_STRING( BUILD_VERSION ) << endl;
    }
    

    i don’t have QMake but I gather that the problem is that QMake does a TO_STRING-like operation, and then also doing it yourself, as I noted first, is a general solution.


    EDIT: @sixones asks in a follow up comment,

    here’s a warning thrown from the use of TO_STRING; warning C4003: not enough actual parameters for macro ‘TO_STRING_AUX’ any ideas how to solve?

    The problem is apparently that the macro passed as argument is defined as nothing (not undefined, but defined as nothing).

    A solution is to use a C99/C++11 variadic macro definition, as follows:

    #define TO_STRING_AUX( ... )    "" #__VA_ARGS__
    #define TO_STRING( x )          TO_STRING_AUX( x )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Visual Studio 2008 - I add a Setup project (from Setup and Deployment
I'm not using the default Visual Studio project path to build my program into,
We are developing customized installer using visual studio 2008 installer project. The requirement which
Using Visual Studio 2008, I created a C++ Win32 project. To release the program,
Using visual studio 2008. When I add a new aspx form to a project
I am using Visual Studio 2010 to create a setup project for my .NET
I am using Visual Studio 2010 SP1 Ultimate on a c# class library project
We've been using Visual Studio 2005 Team Suite for a fairly large web project.
I'm using Visual Studio 2008 and have created a setup project for my application.
I just began using Visual Studio to work on a practice .NET project. I

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.