tags:

views:

53

answers:

3

I have a C++ codebase, and I am porting from Visual Studio to g++, which should I set in Visual Studio so that build errors in gcc are reduced? With g++ this is achieved by -ansi -pedantic.

+1  A: 

The only real way to do this is to compile under VStudio AND under GCC. GCC can be a lot more pedantic than VStudio :)

Goz
@Goz:"GCC can be a lot more pedantic than VStudio" -- and vice versa. They're pedantic about different things.
Jerry Coffin
+3  A: 

I believe you are looking for /Za.

Billy ONeal
Had totally forgotten about that switch. TBH, though, GCC is still a HELL of a lot more pedantic :)
Goz
+1  A: 

You should probably set the highest warning level /W4 and also disable the MS specific language extensions, /Za. Also check that you're using the for loop scope option /Zc:forScope

the_mandrill
/Zc:forScope is the default. There is no need to specify this switch explicitly.
Billy ONeal
It's the default for new projects, but if you have a project that was started in VS2003 and then upgraded through 2005 and/or 2008 then it will be switched off, so it's worth checking.
the_mandrill