开发者

Full path names printed for __FILE__ in VS2008

开发者 https://www.devze.com 2023-02-13 06:46 出处:网络
Our code uses __FILE__ to print code locations in a log file. Our intent is for all instances of __FILE__ to print the filename ONLY, no path.

Our code uses __FILE__ to print code locations in a log file.

Our intent is for all instances of __FILE__ to print the filename ONLY, no path.

However, we just noticed that while source (.cpp files) correctly print just the filename, the headers (.h files) print the full path. This exposes our build server's path on customer instal开发者_开发技巧lations, which is confusing at best.

I have researched the /FC (full pathnames) compile option and how it relates to the /ZI and /Zi (debug info generation) compile options. Short version - /ZI implies /FC. We are currently using /Zi, but we are not using either /ZI or /FC, so we should be fine.

We are using a project-wide precompiled header (PCH), but none of the headers included in the PCH use __FILE__, so that seems irrelevant.

What's going on here?

Is there possibly a latent compile option I'm triggering?

Does anyone know of a workaround that doesn't involve calling run-time string manipulation functions?


This is asserted as "by design" in this feedback article. Consider a post-processing step that hacks the paths the way you want them.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号