c++visual-c++visual-studio-codemsvc12

__FUNC__ undefined in VSCode


I knew __FUNC__ is predefined macro, but when come to vscode it can not recognize __FUNC__.

https://learn.microsoft.com/zh-tw/cpp/preprocessor/predefined-macros?view=vs-2019

Which setting should I need to change or modify?


Solution

  • You want __func__, not __FUNC__. If you’re on gcc or clang and the goal is to get readable output you can use __PRETTY_FUNCTION__ instead which yields better results (such as actually working for template functions).