I am using icpc compiler on both windows (visual studio 2012) and linux (which has g++ 4.8.2 installed). I am running into issues with porting the code from one OS to another. Code that compiles on windows without any major modifications, fails to compile of linux (having me make significant changes, especially at places where I am working with templates, specialized templates and template inheritance) , so I tried comparing compiler switches/triggers generated by windows(in VS2012 ) and the one that I provide in my cmake (CMakeLists.txt) but none of my combination seem to help.
Following is command line (generated by VS2012) on windows
/GS /W3 /Zc:wchar_t /I"C:\Program Files (x86)\Intel\Composer XE\tbb\include" /I"..\..\..\..\ThirdParty\boost\boost_1_55_0" /Zi /Od /Fd"C:\SomeDir\msvs\obj\Debug\vc110.pdb" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "TBB_USE_DEBUG" /D "_CRT_SECURE_NO_DEPRECATE" /D "_MBCS" /Qstd=c++0x /WX /Zc:forScope /arch:SSE3 /Gd /Oi /MDd /Fa"C:\SomeDir\msvs\obj\Debug\" /EHa /nologo /Fo"C:\SomeDir\msvs\obj\Debug\" /Fp"C:\SomeDir\msvs\obj\Debug\FilterDemo.pch"
Following is what I have tried in linux (in my CMakeLists.txt)
set(CMAKE_CXX_FLAGS " -w3 -std=c++11")
set(CMAKE_CXX_FLAGS " -W -Werror -Wall -std=c++11")
set(CMAKE_CXX_FLAGS " -W -Werror -std=c++11")
Can anyone kindly help me with this porting issue, specifically, could you please advise what common compiler flags are supposed to be set on windows and linux for the ease of porting the code from one OS to another.
Thank you in advance.
On Linux you can try these:
enable compatibility with a specific Microsoft* Visual Studio
9 - Microsoft* Visual Studio 2008 compatibility
10 - Microsoft* Visual Studio 2010 compatibility
11 - Microsoft* Visual Studio 2012 compatibility
Or on Windows you can try these:
enable a limited gcc-compatible dialect on Windows. The gcc
version may be specified as 440, 450 or 460.
Example: /Qgcc-dialect:440 -> gcc 4.4 compatibility
This won't guarantee you won't still have some porting isss, but it should help.
Thank you for your help Judith. Neither of them help in terms of reducing the number of changes that I have to make to windows generated code nevertheless, it is good to know that there is such an option.