1

I want to hide machine specific path part from executable.

Is it possible to force relative path for PDB symbols and __FILE__ macro?

So that some/all initial parts of path are not put into file?

I use MSVC, GCC solutions will not work.

All options are following:

/permissive- /MP /GS /Zc:rvalueCast /analyze- /W3 /Zc:wchar_t /I"
<some path here>" /Qspectre-load /ZI /Gm- /Od /sdl /Fd"<some path here>"
/Zc:inline /fp:precise /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D
"_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /RTC1
/GR- /Gd /Oy- /MTd /openmp- /Fa"<some path here>" /EHa /nologo
/Fo"<some path here>" /Fp"<some path here>" /diagnostics:classic
Reinier Torenbeek
  • 16,669
  • 7
  • 46
  • 69
adontz
  • 1,428
  • 16
  • 36
  • I don't know about VS, so I don't know if the behaviour of the macro can be configured. But instead of doing that, you can remove the parent path at runtime. – eerorika Mar 30 '20 at 11:45
  • Looks like a duplicate of [this](https://stackoverflow.com/questions/8487986/file-macro-shows-full-path) – Ryan Pepper Mar 30 '20 at 11:46
  • duplicates: [How do I configure MSVC to show relative path for header files using `__FILE__`?](https://stackoverflow.com/q/41567178/995714), [`__FILE__` macro shows full path](https://stackoverflow.com/q/8487986/995714), [C++ `__FILE__` macro with absolute path](https://stackoverflow.com/q/50124235/995714) – phuclv Mar 30 '20 at 11:47
  • No, sorry, I need MSVC solution. – adontz Mar 30 '20 at 13:51
  • there are many Windows and MSVC solutions in the other question – phuclv Mar 30 '20 at 16:42
  • The question is not how to extract base name from file path. The question is how to prevent full path from compiled executable in the first place. – adontz Mar 30 '20 at 19:24

1 Answers1

1

Compile your program without /FC and /ZI options.

Öö Tiib
  • 10,809
  • 25
  • 44