nagyistoce / platinum-image

Automatically exported from code.google.com/p/platinum-image
0 stars 0 forks source link

Disable Microsoft C++ extensions #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The MS extensions to C++ do not compile in GCC, causing recurring problems when 
building code 
developed with MSVC on other platforms.

Solution: disable MS extensions in CMakelist using the /Za flag:
http://msdn2.microsoft.com/en-us/library/0k0w269d(vs.71).aspx

Original issue reported on code.google.com by arvi...@gmail.com on 18 Apr 2007 at 10:18

GoogleCodeExporter commented 9 years ago

Original comment by arvi...@gmail.com on 23 Apr 2007 at 7:42

GoogleCodeExporter commented 9 years ago
The /Za flag seems like the right way to go, however two problems have emerged:
1. it's difficult (not yet solved) to set compiler flags in MSVC through CMake. 
There
are examples out there, but these to not work copied straight
2. Windows headers use the MS extensions, and FLTK appears to use these headers 
- so
extensions have to be disabled for some source files only.

Original comment by arvi...@gmail.com on 23 Apr 2007 at 9:36

GoogleCodeExporter commented 9 years ago
These are some strategies that have been used in other projects, for 
inspiration:
# (1)
IF(MSVC)
  ADD_DEFINITIONS(-Za)
ENDIF(MSVC)

# (2)
IF(MSVC)
  SET_SOURCE_FILES_PROPERTIES(color.cc PROPERTIES  COMPILE_FLAGS -Za)
ENDIF(MSVC)

# (3)
IF(MSVC)
  ADD_DEFINITIONS(-Za -W4)
ELSE(MSVC)    
  ADD_DEFINITIONS(-ansi -pedantic)  
ENDIF(MSVC) 

Original comment by arvi...@gmail.com on 23 Apr 2007 at 12:28

GoogleCodeExporter commented 9 years ago
MSVC skips preprocessing of code blocks that are not referenced. This can be 
highly annoying, especially as 
GCC does this. Maybe there is a flag to disable this behavior?

Original comment by arvi...@gmail.com on 10 May 2007 at 2:50

GoogleCodeExporter commented 9 years ago
The work involved in this issue (which doesn't seem to be completely 
adressable) may
be reduced by increasing the warning threshold using this flag in GCC:
-fpermissive

Original comment by arvi...@gmail.com on 18 Jun 2007 at 8:45

GoogleCodeExporter commented 9 years ago
-fpermissive removed from GCC build instructions because it allows some 
nonstandard syntax (e.g. declare 
static both in header and body) that MSVC does not accept.
With the strictest syntax check, GCC can be used as the gold standard for 
Platinum syntax.

Original comment by arvi...@gmail.com on 3 Jul 2007 at 3:51