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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:35:36+00:00 2026-06-03T18:35:36+00:00

I’ve got a piece of code that’s automatically generated that compiles on Linux but

  • 0

I’ve got a piece of code that’s automatically generated that compiles on Linux but not on Windows using Visual Studio 2008 Express. The issue I’m having is that I don’t understand the compiler error. I don’t think I can post the exact code, so here’s a sanitized version of it…

Error is reported for the line declaring the static const DELETE. Note: The compiler error doesn’t show up when this file is compiled – it builds into a library successfully, but shows up in a second project that includes the header (indirectly). I believe there are at least one or two other projects that include it indirectly in the solution – they have no issues compiling.

File_A.h:

enum LONG_TYPE_NAME {
  ENUM_NAME_PREFIX_ADD = 0,
  ENUM_NAME_PREFIX_CHANGE = 1,
  ENUM_NAME_PREFIX_DELETE = 2,
  ENUM_NAME_PREFIX_SOMETHINGELSE = 3,
};
//Lots of code here
class FOO : public ::LIBRARY_NAME {
 public:
  //Some stuff
  private:
  //Some stuff
  public:
  //Some more stuff

  typedef LONG_TYPE_NAME SHORT_NAME;
  static const SHORT_NAME ADD = ENUM_NAME_PREFIX_ADD;
  static const SHORT_NAME CHANGE = ENUM_NAME_PREFIX_CHANGE; 

  /* compiler error for the following line only*/
  static const SHORT_NAME DELETE = ENUM_NAME_PREFIX_DELETE; 
  static const SHORT_NAME SOMETHINGELSE = ENUM_NAME_PREFIX_SOMETHINGELSE; 

  //More stuff
};

The constant itself only shows up in one place (when I search through the project for the term DELETE):

File_A.cc:

#ifndef _MSC_VER
const LONG_TYPE_NAME FOO::ADD;
const LONG_TYPE_NAME FOO::CHANGE;
const LONG_TYPE_NAME FOO::DELETE;
//More stuff
#endif  // _MSC_VER

The error reported is error C2059: syntax error : 'constant' (followed by error C2258: illegal pure syntax, must be '= 0' and error C4430: missing type specifier - int assumed. Note: C++ does not support default-int which I assume are not relevant), but not when the files above are being compiled.

The files are compiled to a library which is statically linked to by another project (C++) – this is the one that’s generating the error (as well as in a second .cpp file that does something similar). It still shows up when I comment out all the code, so I assume it has something to do with header inclusions.

Commenting out the line generating the error makes the build work on Windows (and fail on Linux, but I assume that commenting out its counterpart in the ifndef should fix that), but I really want to know why the compiler is failing for that particular line and what the error actually means. Also, it’s probably better not to modify code that’s been automatically generated.

EDIT: Splitting up the terms into individual lines makes the compiler point to the DELETE line. Maybe there’s a macro automatically defined with the name DELETE somewhere?

EDIT 2: Cleaned up the heading section a bit to clear up some possible misconceptions.
Incidentally, renaming the DELETE variable also clears out the error.

EDIT 3: Clearly I need to learn more about VS – /P generates the preprocessed file without producing the object file, so the build will of course fail without generating compilation errors. Also, it does look like there is a macro somewhere, which defines DELETE as (0x00010000L).

  • 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-03T18:35:37+00:00Added an answer on June 3, 2026 at 6:35 pm

    There’s definitely a macro DELETE defined somewhere.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.