0

I am trying to run C:\MinGW\bin\cpp.exe -v -o main.txt test.c on test.c:

#ifdef HELLO
HELLO!
#else
BYE!
#endif

but only get the following output, no apparent error, and no main.txt is written (nor any other file):

Using built-in specs.
COLLECT_GCC=C:\MinGW\bin\cpp.exe
Target: mingw32
Configured with: ../src/gcc-8.2.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-8.2.0-5' --with-gmp=/mingw --with-mpfr=/mingw --with-mpc=/mingw --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --with-isl=/mingw --enable-libgomp --disable-libvtv --enable-nls --disable-build-format-warnings
Thread model: win32
gcc version 8.2.0 (MinGW.org GCC-8.2.0-5)
COLLECT_GCC_OPTIONS='-E' '-v' '-o' 'main.txt' '-mtune=generic' '-march=i586'
 c:/mingw/bin/../libexec/gcc/mingw32/8.2.0/cc1.exe -E -quiet -v -iprefix c:\mingw\bin\../lib/gcc/mingw32/8.2.0/ test.c -o main.txt -mtune=generic -march=i586


I've found Denis Auroux / Tristan Miller's GPP and a windows build which works as expected (gpp.exe -o main.txt test.c - actually, you'll want the -C option, see the docs), but I'm still interested in what the problem is with my usage of cpp.
handle
  • 5,859
  • 3
  • 54
  • 82
  • 1
    Looks kind of like cc1 dies or doesn't even start. My cpp works fine. I suggest checking if Process Monitor can tell you more. – David Macek May 11 '20 at 19:11
  • @DavidMacek Thanks! It died because it could not find a DLL because it was not set in *Path*... I did not get the error message dialog about this because the cmd.exe I was using was started in another application. – handle May 12 '20 at 15:58
  • Happy to have helped. – David Macek May 12 '20 at 19:49

1 Answers1

0

I was running this in a Command prompt "spawned" by a file manager. Running cmd.exe directly, the following error message dialog is shown:

---------------------------
cc1.exe - System Error
---------------------------
The code execution cannot proceed because libgmp-10.dll was not found. Reinstalling the program may fix this problem. 
---------------------------
OK   
---------------------------

Process Monitor shows a final Exit Status: 1 but I don't see above DLL when filtering for Process Name cpp.exe, though there are some BUFFER OVERFLOW results for cc1.exe as well.

The DLL in question is present in my C:\MinGW\bin, so adding this path to the Environment Variables not only fixes the issue "libgmp-10.dll is missing", but also makes cpp.exe known so no path is needed when running it.

handle
  • 5,859
  • 3
  • 54
  • 82