Visual Studio Express / Windows SDK?

This is a discussion on Visual Studio Express / Windows SDK? within the C++ Programming forums, part of the General Programming Boards category; I want to try out the Microsoft compiler since I heard it can sometimes produce faster binaries than GCC on ...

  1. #1
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,146

    Visual Studio Express / Windows SDK?

    I want to try out the Microsoft compiler since I heard it can sometimes produce faster binaries than GCC on Windows, but am not planning to use the VS IDE. I am trying to figure out what I need to download, but the Microsoft website doesn't seem too helpful. If I only want to use the compiler from the command line (cl.exe), do I only need the Windows SDK? Can it compile 64-bit binaries? or does it have same restrictions as VS Express? and does it support PGO?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,981
    I suppose you could always download the entire package and just use the compiler. I think the Windows SDK affects what you can build, not how you build it, so you probably won't need it if you only intend to write command line programs using just the standard library, whether you use the VS IDE or not.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,146
    The reason I am asking is that according to some sources (including Wikipedia), VS Express doesn't support building 64-bit binaries (which is important for my chess program), but it's possible using cl.exe from the command line from Windows SDK, which seemed odd to me, since Windows SDK is included in VS Express? VS Express also doesn't support PGO, but that's of lesser concern to me.

  4. #4
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    At my last company, they were forever stuck in the 90's and using VC++ 6.0, and I remember when I needed to build a 64-bit DLL I had to use a makefile with the Windows SDK instead of VC++. So as for the 64-bit part of the question, yes, the SDK will let you build in 64-bit. As for whether you need VC++ at all, that would depend on whether the SDK comes with all the standard header files..., which I don't see why it would, since it's an SDK.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  5. #5
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    611
    The Server 2008 SDK only installs the IA64 version of the PGO dll, however you can compile pgo enabled apps for any platform.

  6. #6
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,146
    Ah I see. Thanks.

    I don't need the win32 headers, though. Just the standard ones (and I will be compiling Boost).

    Hmm I downloaded and installed the latest Windows SDK, and I don't see a cl.exe in there...

  7. #7
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,146
    Apparently the compiler is installed into
    C:\Program Files\Microsoft Visual Studio 9.0
    instead of
    C:\Program Files\Microsoft SDKs\Windows

  8. #8
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,146
    Compiling Boost atm. It's taking forever for some reason (at least 30 minutes now). Only took 10-15 minutes with MinGW (GCC 4.4.0 SVN) IIRC.

  9. #9
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,146
    What's MSVC's equivalent to GCC's "-O3"? The documentation seems confusing, with all those options for /O.
    Code:
                                  -OPTIMIZATION-
    
    /O1 minimize space                      
    /O2 maximize speed
    /Ob<n> inline expansion (default n=0)   
    /Od disable optimizations (default)
    /Og enable global optimization          
    /Oi[-] enable intrinsic functions
    /Os favor code space                    
    /Ot favor code speed
    /Ox maximum optimizations               
    /Oy[-] enable frame pointer omission
    I tried
    Code:
    cl /EHsc /Ox asdf.cpp
    Is that optimal?
    The resulting binary is a little bit (~5-10%) slower than the one produced by GCC 4.4.0 SVN (-O3), for my program.

  10. #10
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,188
    How about...
    Compiler: /Ox /Ob2 /Oi /Oy /GL /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_CRT_SECURE_NO_WARNINGS" /D "_AFXDLL" /D "_UNICODE" /D "UNICODE" /FD /EHsc /MD /GS- /Gy /arch:SSE2 /Za /Fo"Release\\" /Fd"Release\vc90.pdb" /W4 /nologo /c /Zi /TP /errorReport:prompt
    Linker: /OUT:"D:\w00t\Documents\Visual Studio 2008\Projects\Temp\Release\Temp.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"Release\Temp.exe.intermediate.manife st" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"d:\w00t\Documents\Visual Studio 2008\Projects\Temp\Release\Temp.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT winmm.lib
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

  11. #11
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,146
    Hmm okay thanks!

    Time to go read the documentation...

  12. #12
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,146
    Does anyone know how to build 64-bit Boost for MSVC?

    I tried
    Code:
    bjam --toolset=msvc-9.0_64 --build-type=complete msvc stage
    As per some random page that came up from Google.
    Everything worked, but it still only produced 32-bit libraries.
    Last edited by cyberfish; 01-18-2009 at 09:00 PM.

  13. #13
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,146
    Ah figured it out.

    "address-model=64" is needed in addition to setting the toolset.

    Code:
    bjam --toolset=msvc-9.0_64 --build-type=complete address-model=64 msvc stage

  14. #14
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,146
    I did some benchmarking using my program (a chess engine), using its own benchmarking function (search 100 randomly pre-selected positions to a fixed depth, completely deterministic). Every "run" is run twice, and higher of the 2 taken (differences between runs were all within 1%). The numbers are Mnps (million nodes per second) searched. Higher the better.

    I used 4 compilers - MSVC 9 64-bit, MSVC 9 32-bit, GCC 4.4.0 SVN 64-bit, GCC 4.2.1 32-bit.

    For MSVC, I adopted relevant (optimization-related) options from the list Elysia posted.

    The program does a lot of low level twiddling with 64-bit integers (called bitboards in computer chess), and is heavily recursive.

    All the tests are run inside a VMware virtual machine running 64-bit XP Pro. Host is 64-bit Linux.

    64-bit MinGW is my own build of GCC with mingw-w64 -
    http://sourceforge.net/forum/forum.p...orum_id=723797

    Code:
    MSVC 64-bit
    Microsoft (R) C/C++ Optimizing Compiler Version 15.00.21022.08 for x64
    
    no optimization - 
    0.486265
    
    /Ox - 
    1.52933
    
    /Ox /Ob2 /Oi /Oy (Elysia's suggestion) - 
    1.55582
    Code:
    MSVC 32-bit
    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
    
    no optimization - 
    0.392031
    
    /Ox - 
    0.953033
    
    /Ox /Ob2 /Oi /Oy (Elysia's suggestion) - 
    0.951351
    Code:
    GCC (MinGW 64-bit)
    gcc version 4.4.0 20081101 (experimental) (GCC)
    
    -O3 - 
    1.74929
    
    -O3 -march=native - 
    1.76843
    Code:
    GCC (MinGW 32-bit)
    gcc version 4.2.1-dw2 (mingw32-2)
    
    no optimization - 
    0.405505
    
    -O3 - 
    1.04415
    
    -O3 -march=native - 
    1.01338
    For (unfair) comparison, on the Linux host, I get 2.585 Mnps. Didn't think virtualization would matter this much since this program is quite CPU-intensive.

    As it appears, gcc 4.2.1 was only slightly (6%) faster than MSVC (both 32-bit), but gcc 4.4.0 SVN was quite a bit (14%) faster than MSVC (both 64-bits). Guess GCC people haven't been slacking off . But I think even GCC 4.2.1 was released after MSVC 9, and GCC 4.4.0 is not even released yet. Too bad we can't get MSVC SVN.

    BTW, does MSVC have something like "-march" for GCC (optimize for a specific target)? I can't seem to find it in the documentation.
    Last edited by cyberfish; 01-20-2009 at 01:50 AM.

  15. #15
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,188
    None that I know of, really. Also keep in mind that both compilers can perform differently on different code.
    And you did not seem to optimize with any SSE code either...
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. writing windows dlls using visual studio 2008 express
    By xixpsychoxix in forum Windows Programming
    Replies: 17
    Last Post: 01-22-2009, 02:53 AM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. multiple errors generated by socket headers
    By nocturna_gr in forum Windows Programming
    Replies: 5
    Last Post: 12-16-2007, 05:33 PM
  4. Problem Compiling Program
    By wco5002 in forum C++ Programming
    Replies: 13
    Last Post: 11-06-2007, 11:56 AM
  5. Visual Studio Express for free
    By Frobozz in forum C# Programming
    Replies: 2
    Last Post: 04-29-2006, 09:59 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21