Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 11, 2016, 12:16:50 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Visual C++ 2008 Express and native x64 output ?  (Read 15038 times)

Defenestration

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 81
    • View Profile
    • Donate to Member
Visual C++ 2008 Express and native x64 output ?
« on: November 21, 2007, 03:45:38 PM »
I've recently been trying VC++ 2008 Express and am loving the new /MP option which spawns multiple processes to compile. It has cut my compilation times by two-thirds on a quad core :)

However, I want to use it to produce native 32-bit and 64-bit apps. From what I've read you supposedly have to install the Windows SDK, but after doing this I still can't get it to target x64.

Does anyone know if this is possible with VC++ 2008 Express and, if so, are there any step-by-step instructions on how to set it up (including URL's of the files/SDK's that need downloading) ?

PS. I'm developing on XP Pro x64 SP2.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,029
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Visual C++ 2008 Express and native x64 output ?
« Reply #1 on: November 21, 2007, 04:48:13 PM »
Hmmmm, /MP? I see that it's for cl.exe, how does it work? If you specify only a single .c or .cpp file on the commandline, can it still effectively use multiple processes (I bet not)? I've been using multi-instance compiling with SCons build scripts, and supposedly VS2005 supports it in the IDE (I never got it to kick in though, it always only shows 1> in the output log, never 2>). Interesting to see it in the compiler, though.

Interestingly I don't see an option for compiling to 64bit code on the compiler, I would have expected it there, neither for vs2008 express nor vs2005 full. I googled a bit, and came across this, which says x64 tools aren't installed by default... so it would seem there are separate compiler binaries for 32- and 64-bit. I followed the instructions there to make an x64 build of fSekrit (which doesn't succeed atm :)), and with Process Explorer I could see that indeed it uses a different compiler,C:\vs\VC\bin\x86_amd64\cl.exe.

The VS2008 Express edition does not seem to include a path like that, the entire install only has three files with "64" in the file name, and indeed no compiler. And iirc the installer didn't offer a custom option?

But on the download page, it says that you can create x64 native apps, HMMM!

Anyway, iirc you get the x64 compiler with the PlatformSDK, or perhaps it's the DDK, but I dunno if it's as fully featured as the compiler from VS Pro.

EDIT: seems like MS decided to rename "GWL_WNDPROC" to "GWLP_WNDPROC", but keep the GWL_ version when you're compiling for 32-mode, but drop it when compiling for x64. Fixed that, and fSekrit builds okay for x64. And heck, it even (seems to ;P) work, bloats exe size by 40k though.
- carpe noctem
« Last Edit: November 21, 2007, 05:04:36 PM by f0dder »

mwb1100

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,522
    • View Profile
    • Donate to Member
Re: Visual C++ 2008 Express and native x64 output ?
« Reply #2 on: November 21, 2007, 05:04:36 PM »
I'm not sure, but I don't think VC++ Express supports x64 targets.  For VS 2008 Standard and above, x64 targets are supported, but you have to do a custom install and manually select the option.  I don't see that the Express install lets you do that.  The readme mentions that "x64 (WOW)" is supported, but I think that simply means that the product will work on an x64 platform.  There's nothing that I saw in the readme about what targets are supported.

mwb1100

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,522
    • View Profile
    • Donate to Member
Re: Visual C++ 2008 Express and native x64 output ?
« Reply #3 on: November 21, 2007, 05:08:30 PM »
Hmm...  this page (which is for VC++ 2005 so it may not apply to 2008) says that you can enable x64 targets in Express by installing the .NET Framework SDK:

http://msdn2.microso...9yb4317s(VS.80).aspx

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,029
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Visual C++ 2008 Express and native x64 output ?
« Reply #4 on: November 21, 2007, 05:10:51 PM »
The overview page specifically says "Create native Win32 and Win64 applications", and I'm attaching a screenshot of it in case Microsoft decides to fix that page :)

2008xp_win64.jpgVisual C++ 2008 Express and native x64 output ?

...I wonder if the dotNET framework SDK gives you the "full" compiler (ie, no handicapping of the optimizer and things like that), the 64bit libraries, and whether it's just for dotNET apps or can do native as well?
- carpe noctem

Defenestration

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 81
    • View Profile
    • Donate to Member
Re: Visual C++ 2008 Express and native x64 output ?
« Reply #5 on: November 21, 2007, 06:15:13 PM »
Hmm...  this page (which is for VC++ 2005 so it may not apply to 2008) says that you can enable x64 targets in Express by installing the .NET Framework SDK:

http://msdn2.microso...9yb4317s(VS.80).aspx

I also read that page, and have read another which says you need to install Windows SDK. However, I have tried both methods and still had no luck producing a nativwe x64 app.

Hmmmm, /MP? I see that it's for cl.exe, how does it work? If you specify only a single .c or .cpp file on the commandline, can it still effectively use multiple processes (I bet not)? I've been using multi-instance compiling with SCons build scripts, and supposedly VS2005 supports it in the IDE (I never got it to kick in though, it always only shows 1> in the output log, never 2>). Interesting to see it in the compiler, though.
I don't use the command-line, but the /MP switch will spawn separate compiler processes for different source files (eg. if your project consists of source1.cpp and source2.cpp, then VS2008 can compile them simultaneously. However, if your project only consists of a single source file, then the /MP switch will not have any effect). I have a quad core, and the /MP switch results in five compiler processes being spawned (ie. number of cores + 1). You can also specify exactly how many processes should be spawned by using /MP[number of processes - 1].

VS2005 supported building multiple projects simultaneously, but not multiple source files within a single project.

Interestingly I don't see an option for compiling to 64bit code on the compiler, I would have expected it there, neither for vs2008 express nor vs2005 full.[/b]
I have successfully managed to compile a native x64 app with VC++ 2005 Standard (I did a full install of VS2005 + SP1 + Intellisense hotfix), although this doesn't work with all my apps. To do this, do the following:

1) Load the project
2) Go to Build...->Configuration Manager
3) Select "New..." from the Active Solution platform drop-down
4) If all is well, "x64" should be selected in the "Type or select the new platform" combo.
5) Compile with the target set to x64.

Anyway, iirc you get the x64 compiler with the PlatformSDK, or perhaps it's the DDK, but I dunno if it's as fully featured as the compiler from VS Pro.
The compilers in the Express editions are supposed to be the same. The only difference being added tools like resource editor, unit test, more options can be specified through prefs dialog etc. I'm wondering whether the 64-bit compilers in Windows Server 2008 Platform SDK also support the /MP switch though.

Fixed that, and fSekrit builds okay for x64. And heck, it even (seems to ;P) work, bloats exe size by 40k though.
People running an x64 OS aren't bothered by the slight bloat if it means they get to run a native x64 app ;)  ;D

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,029
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Visual C++ 2008 Express and native x64 output ?
« Reply #6 on: November 21, 2007, 06:40:17 PM »
I figured out how to add x64 config myself, but thanks for posting it here anyway - somebody else might read & benefit (it's mentioned on the MS page I posted a link to). 40kb is a lot of bloat for fSekrit, and it doesn't really benefit from x64 version, but it was what I was working on so it was what I tried building for x64. Almost surprised it worked with no changes... dunno if there's any x64-related bugs in it, though :P

Wrt. supporting /MP switch, I doubt that should be necessary, unless the way the IDE works has been changed; in 2005 it doesn't invoke cl.exe with a long list of files, it invokes it once per file... so if the 2008 IDE hasn't changed, it will not use /MP but manually spawn threads.
- carpe noctem

Carol Haynes

  • Waffles for England (patent pending)
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 7,986
    • View Profile
    • Dales Computer Services
    • Donate to Member
Re: Visual C++ 2008 Express and native x64 output ?
« Reply #7 on: November 21, 2007, 06:45:00 PM »
Out of curiosity what happens if you install Express on a 64-bit platform? Does it still compile to 32-bit or does it work out that you are using 64-bit and default to that?

Defenestration

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 81
    • View Profile
    • Donate to Member
Re: Visual C++ 2008 Express and native x64 output ?
« Reply #8 on: November 21, 2007, 07:34:34 PM »
Out of curiosity what happens if you install Express on a 64-bit platform? Does it still compile to 32-bit or does it work out that you are using 64-bit and default to that?
I installed to XP Pro x64 SP2 and it defaults to Win32.

Carol Haynes

  • Waffles for England (patent pending)
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 7,986
    • View Profile
    • Dales Computer Services
    • Donate to Member
Re: Visual C++ 2008 Express and native x64 output ?
« Reply #9 on: November 22, 2007, 02:15:48 AM »
Thought it might - now there's logic for you ;)

Eóin

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,401
    • View Profile
    • Donate to Member
Re: Visual C++ 2008 Express and native x64 output ?
« Reply #10 on: November 22, 2007, 02:28:16 AM »
The full x64 C++ build environments are freely availible but you don't get an IDE. The Vista SDK and if memory serves me correctly then also the Server 2003 SDK R2 both have everything you need, though you have to select x64 manually as a component to install. Unfortunately in both these case you get the VS2005 compilers, not 2008.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,029
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Visual C++ 2008 Express and native x64 output ?
« Reply #11 on: November 22, 2007, 06:15:41 AM »
The full x64 C++ build environments are freely availible but you don't get an IDE. The Vista SDK and if memory serves me correctly then also the Server 2003 SDK R2 both have everything you need, though you have to select x64 manually as a component to install. Unfortunately in both these case you get the VS2005 compilers, not 2008.
Is it at least the FULL x64 VS2005 compilers without any handicaps, then?

And where are the x64 libc+STL libraries from, I guess you get them from the SDK, and in 2005 versions?
- carpe noctem

Eóin

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,401
    • View Profile
    • Donate to Member
Re: Visual C++ 2008 Express and native x64 output ?
« Reply #12 on: November 22, 2007, 09:31:45 AM »
Good question. The x86 cl.exe targeting amd64 version number from the Server 2003 SDK R2 is 14.0.40310.41, from Vista SDK it's 14.0.50727.42 while the one from VS 2005 SP1 is 14.0.50727.762. Now I'm not sure what the pre SP1 VS 2005 version was.

The Vista SDK really is a complete dev package, it has all the libraries, but no MFC or ATL. However you can get an old version of them from the PSDK which is enough to use WTL should you want. Otherwise the PSDK doen't have the x86 tools at all, you need VS 2005 C++ Express to get those.

The other download worth checking out is Microsoft® Windows® Software Development Kit (SDK) for Windows Server code name “Longhorn” and .NET Framework 3.5 which I don't have downloaded yet.


f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,029
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Visual C++ 2008 Express and native x64 output ?
« Reply #13 on: November 22, 2007, 10:57:34 AM »
Sounds messy :)

As for WTL, isn't there a separate download package that has everything you need, or does WTL depend on some MFC/ATL headers? :-s
- carpe noctem

Eóin

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,401
    • View Profile
    • Donate to Member
Re: Visual C++ 2008 Express and native x64 output ?
« Reply #14 on: November 22, 2007, 06:56:05 PM »
F0dder you're right it relies on ATL. Thankfully the people behind WTL continune to support the freely availible ATL version 3.0 I believe together with the more recent versions.