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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:18:52+00:00 2026-06-01T10:18:52+00:00

I use the __FILE__ macro for error messages. However, sometimes the path comes back

  • 0

I use the __FILE__ macro for error messages. However, sometimes the path comes back as E:\x\y\/z.ext. It does this for specific files.

For example, E:\programming\v2\wwwindowclass.h comes back as E:\programming\v2\/wwwindowclass.h and E:\programming\v2\test.cpp comes back as E:\programming\v2\test.cpp. In fact, the only file in the directory that works seems to be test.cpp.

To work around this, I used jmucchiello’s answer to this question to replace any occurrence of “/” with “\”. This worked fine, and the displayed path changed to a normal one.

The problem was when I tried it on Windows 7 (after using XP). The string came up as (null) after calling the function.

Along with this, I sometimes get some seemingly random error 2: File not found errors. I’m unsure of whether this is related at all, but if there’s an explanation, it would be nice to hear.

I’ve tried to find why __FILE__ would be returning the wrong string, but to no avail. I’m using GNU g++ 4.6.1. I’m not actually sure yet if the paths that were wrong in XP were wrong in Windows 7 too. Any insight is appreciated.

  • 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-01T10:18:54+00:00Added an answer on June 1, 2026 at 10:18 am

    As per MSalters’s comment:

    Typically, the compiler does so when you pass #include "v2/wwwindowclass.h" to the compiler. 
    Since every file has its own include statements, you can (but shouldn't) mix the two styles.
    

    This was the case. My compiler automatically adds a forward slash.

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

Sidebar

Related Questions

I have macro like this: #define error_exit(format, ...) \ error_at_line(EXIT_FAILURE, 0, __FILE__, __LINE__, format,
I'm trying to use rspec with mongoid but I'm running across this error: undefined
I try to create cross toolchian for arm but have this error: In file
I'm trying to use the TRACE macro to send the file name to the
I am using define to create a macro. However, within a define construct, I
Using Visual Studio 2008, I keep seeing this error in the output window: _CrtDbgReport:
I am trying to use this code to define the APIs that are needed
Hi i try use Nlog in with caliburn micro, I have use this tutorial
I'm a newbie in boost.python and i'm getting this error that I would like
In a multi-threaded application, I use the following ASSERT macro to catch coding and

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.