Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. __FILE__ macro

__FILE__ macro

Scheduled Pinned Locked Moved C / C++ / MFC
announcementdebugging
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Saurabh Garg
    wrote on last edited by
    #1

    I am using __FILE__ macro in my application. In the debug version it returns the absolute path of the source file but in the release version it return path relative to project directory. Is this normal behaivour or am I missing something. thanks, -Saurabh

    S 1 Reply Last reply
    0
    • S Saurabh Garg

      I am using __FILE__ macro in my application. In the debug version it returns the absolute path of the source file but in the release version it return path relative to project directory. Is this normal behaivour or am I missing something. thanks, -Saurabh

      S Offline
      S Offline
      Sam Liang
      wrote on last edited by
      #2

      HI; Look at the code of follow //----------------------------------- #ifdef _DEBUG//<-----------------NO 1 #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif //----------------------------------- so In the debug mode you can capture the absolute path and In the release mode u capture the project directory instead of absolute path chuanke -- modified at 1:07 Friday 6th January, 2006

      S 1 Reply Last reply
      0
      • S Sam Liang

        HI; Look at the code of follow //----------------------------------- #ifdef _DEBUG//<-----------------NO 1 #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif //----------------------------------- so In the debug mode you can capture the absolute path and In the release mode u capture the project directory instead of absolute path chuanke -- modified at 1:07 Friday 6th January, 2006

        S Offline
        S Offline
        Saurabh Garg
        wrote on last edited by
        #3

        sorry I forget to mention that this is not a MFC application. I am trying to do this in a console application. anyway I found the solution here[^]. It says use /FC (Full Path of Source Code File in Diagnostics) to get absolute paths using __FILE__. It seems somwhow MFC do that for you in debug but not in release build, although I don't see this switch enabled in the settings. -Saurabh -- modified at 2:45 Friday 6th January, 2006

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups