views:

335

answers:

5

I am getting Visual Studio compiler warnings from third-party includes and my coworker is not. The following are true:

  • We have checked out the exact same code, .vcproj files, and .sln files, with no local modifications.
  • We are including the exact same third-party files.
  • We are using the exact same version of Visual Studio.
  • We have both deleted all temporary (.user, .suo) files.

Can anybody offer an explanation for how this could be happening?

Or, if anyone can give me advice on how to directly eliminate the warnings, that'd be just as good. I've tried the obvious "Disable Specific Warnings" option in Properties > Configuration Properties > C/C++ > Advanced, and I've tried #pragma, to no avail.

+2  A: 

Even if you're using the same project files it's possible to use different include directories because of the 'global' setting for "VC++ Directories" in the Tools/Options dialog.

Look at the BuildLog.htm file file that a build generates for any differences in details. Also, the /showIncludes option can be informative ("C/C++"/Advanced/"Show Includes" in the IDE's project settings).


Edit:

Based on your comment that the warnings are C4244, it sounds like one of the following:

  • one of you is building for x64 and the other is building for x86
  • one of you has /Wp64 set
  • one of you has a different warning level than the other
Michael Burr
Michael, can you expound on this? To reiterate, we are using the exact same .vcproj/.sln files. Are any of those controllable via a global setting? If so, how?
dshin
@dshin: I'm not sure where the "Active Solution Configuration"/"Active Solution Platform" selections are stored, but they'd specify which architecture the build is targeting. Also, compiler options might be leaking in from various environment variables (CL or INCLUDES for example). You should compare the build logs to see what's different.
Michael Burr
I cannot spot any relevant differences between the build files.
dshin
Try putting "cmd /c set" in the "Pre-Build Event" project setting to see if an environment variable setting might be having an effect (they shouldn't unless you specify "/useenv" when loading Visual Studio). Also try setting the "Show Includes" project setting (/showIncludes) to see if something weird is going on with the include path.
Michael Burr
A: 

With the warning error: are you both on the same architecture ?

If you are on a 32bits machine and he is on a 64bits machine, Visual Studio might automatically select the native representation of integers for your respective machines... and they might differ :/

Matthieu M.
No, VS won't automatically do that for the same project/solution on two separate machines. You would have to set the x64 build manually.
Jimmy2Times
We are both on 32-bit machines. FWIW, I'm able to check out the same code on a 64-bit machine and build with no warnings.
dshin
A: 

Check Tools->Options->Projects & Solutions->VC++ Directories

Go through all the different options under the "Show directories for" pulldown

Are the directory lists the same?

AShelly
The lists are identical.
dshin
A: 

In project soultion properties, select C/C++ > 'General' and try setting the 'Detect 64-bit Probabilty Issues' to 'No' if its not already by default for 32-bit complier. /Wp64 (Detect 64-Bit Portability Issues)

also, check which character set is selected in project defaults.

Dave18
/Wp64 settings are identical. We are both on 32 bit machines.
dshin
A: 

Check the build log. Visual Studio generates a full log of what was built, and with exactly which command line switches and flags.

Then check environment variables.

Either the compiler is different, the code is different, or the way the compiler is invoked (check build logs and environment vars) is different.

jalf
The build logs indicate the same command line switches and flags are used.
dshin