Feature request #2156

fixes for Windows - MinGW gcc 4.4.0 compiler

Added by Steven Mizuno over 14 years ago. Updated over 14 years ago.

Assignee:nobody -
Pull Request or Patch supplied: Resolution:fixed
Easy fix?:No Copied to github as #:12216


I have tried compiling QGIS using MinGW with its now current gcc 4.4.0 compiler. There were 2 errors about undefined types and 1 warning that occurred when using gcc 4.4.0.

files affected:

The error is caused by a missing time.h that is included by cwchar in the earlier version of the standard C++ headers and isn't included by the current version. I in noticed in pal.h that there is a test for _MSC_VER which includes the standard C header time.h.

Using this header allowed MinGW to compile OK. However, I realized that the C++ header is what should be included, not the underlying C header, so my patch removes the test for _MSC_VER and just includes the C++ header ctime. There should not be a problem if ctime has been included previously.

The error in this file is caused by missing stdlib.h for similar reasons as in pal.h (bits/stl_algobase.h used to include cstdlib). I have added a line to include the C++ standard header cstdlib.

A warning about _fmode redeclared without dllimport attribute:... occurs in this file. This is because _fmode is being declared and initialized in the module. It is already declared extern in a header so just need to set its value. The proper way is to set _fmode in main() as is done (with _set_fmode() ) when MSVC is the compiler.

Also, the logic for whether MSVC or other (MinGW) is the compiler is somewhat confusing, so I have changed the #ifndef _MSC_VER near the top to #else to be part of the preceding #ifdef _MSC_VER. And the #undef _fmode isn't necessary with MinGW, as far as I can tell, so that was removed. I also added an enclosing #ifdef WIN32 in main() for the MSVC/MinGW statements. The statements used with MSVC were not changed.

I have tested these changes with MinGW/gcc 3.4.5 as well and found no issues.

patch-MinGW-gcc440-fixes.txt Magnifier - MinGW/gcc 4.4.0 fixes (base is r11901) (1.65 KB) Steven Mizuno, 2009-11-27 07:30 AM


#1 Updated by Marco Hugentobler over 14 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

Applied in ca3d00af (SVN r12326). Thanks!

Also available in: Atom PDF