Index: nativeparser.cpp
===================================================================
--- nativeparser.cpp (revision 7280)
+++ nativeparser.cpp (working copy)
@@ -1060,7 +1060,7 @@
// both works fine in Windows and linux
#ifdef __WXMSW__
- wxString Command = cpp_compiler + _T(" -v -E -x c++ -< nul");
+ wxString Command = _T("cmd /c \"") + cpp_compiler + _T(" -v -E -x c++ -< nul\"");
#else
wxString Command = cpp_compiler + _T(" -v -E -x c++ -< /dev/null");
#endif
I found that if we use the old command, sometimes we will failed to correct the gcc include paths. e.g. with gcc4.6, it will failed to collect the include paths.
see below:
nativiparser.cpp, line 1079
when running the command:
if (wxExecute(Command, Output, Errors, wxEXEC_SYNC | wxEXEC_NODISABLE) == -1)
> output Errors
8 count of wxArrayString = {
- = 0xb791a4 L"Using built-in specs.",
[1] = 0xb79214 L"COLLECT_GCC=E:\\code\\cb\\gcc\\MinGW_gcc4.6.1release_static_win32\\MinGW\\bin\\g++.exe",
[2] = 0xb792e4 L"COLLECT_LTO_WRAPPER=e:/code/cb/gcc/mingw_gcc4.6.1release_static_win32/mingw/bin/../libexec/gcc/i686-pc-mingw32/4.6.1/lto-wrapper.exe",
[3] = 0xb79434 L"g++.exe: error: unrecognized option '-<'",
[4] = 0xb794c4 L"Target: i686-pc-mingw32",
[5] = 0xb7a014 L"Configured with: ./configure --prefix=/mingw --host=i686-pc-mingw32 --build=i686-pc-mingw32 --target=i686-pc-mingw32 --with-lto-plugin --with-host-libstdcxx=-lstdc++ --disable-bootstrap --disable-werror --with-arch=i686 --with-tune=generic --enable-languages=c,c++,fortran --enable-libgomp --enable-threads=win32 --enable-lto --with-system-zlib --enable-libstdcxx-debug --enable-version-specific-runtime-libs --enable-fully-dynamic-string --disable-sjlj-exceptions --with-dwarf2 --disable-symvers --enable-checking=release --enable-plugins --enable-cloog-backend=isl --enable-static --disable-shared --disable-nls --disable-win32-registry --with-pkgversion=pcx32",
[6] = 0xb79f34 L"Thread model: win32",
[7] = 0xb79534 L"gcc version 4.6.1 (pcx32) "
look, we will get failed on running this command on mingw gcc 4.6.1.
I have test this patch on both mingw gcc 4.5.x and gcc 4.6.1(pcx), both works fine.
I 'm disposed to change to :
wxString Command = cpp_compiler + _T(" -v -E -x c++ -dD nul");
This can avoid "-<" output error in wxWidgets, and the content to output is much more, which contains all pre-defined compiler macros, and that can be a better supplement of CC plugin. The CC plugin may use "-dD" to distinguish the value of these pre-defined compiler macros.
what does "-<" means?
I can't find this option from: http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html
But I don't think -dD is need, because CC has another function to collect the predefined macros.
look at:
bool NativeParser::AddCompilerPredefinedMacros(cbProject* project, Parser* parser)
it use:
const wxString args(_T(" -dM -E -< nul")); under mingw.
Yes, I know that. But "-< nul" has something error in wx. This also uses wxExecute:
wxExecute(cpp_compiler + args, output, wxEXEC_SYNC | wxEXEC_NODISABLE) == -1
"-dM -E -< nul" may have some errors in some compiler (including my gcc 4.6.1).
So I suggest all avoid "-<".