Is there a way to retrieve predefined macros from the GCC preprocessor without having to use temporary files (e.g. using pipes)?
There is a similar question here on StackOverflow, but all its answers make use of the command line, while I need to read mentioned data from within a process. GCC dump preprocessor defines
Google basically returns a lot of answers to the command line version of the question.
When I try to perform the command line trick of directing output to /dev/null on Linux or NUL on Windows using pipes:
RunAndGetOutput("cpp -dM -E < NUL");
... an error occurs:
cpp.exe: error: <: Invalid argument
cpp.exe: warning: '-x c' last input file has no effect
cpp.exe: fatal error: no input files
compilation terminated.
When I execute the same command from the command line all is fine, and a list of defines it printed.
Is there any way I can fix this problem?