Compiler for 64bit

Anyone have experiance with this?

Page 1 of 1

6 Replies - 1276 Views - Last Post: 20 March 2008 - 01:31 PM Rate Topic: -----

#1 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Compiler for 64bit

Posted 19 March 2008 - 10:31 PM

Ok, so I *thought* it would not be all that hard to get a 64bit compiler (well a compiler that generates code for a 64bit processor) -- but things are harder than my initial research suggested.

For linux this is easy -- there are lots. Just about every major linux compiler has the ability to produce 64bit code... but can any of them produce Windows executables while running under Linux?

For windows things are not so easy. Now I don't really want to buy a professional edition at the moment (I am not working in the C++ world so this would really be a waste of money). So I was looking for free compilers. Now the VC++ 2008 may work once I install the platform development kit... maybe...

I looked into MinGW but really don't understand what (of the 25-30 options) I need to download. I know that GCC has 64bit support, but I don't know if any of the MinGW versions are new enough to have that incorporated. I really don't know anything about the world of MinGW. I *think* that I need to install MinGW and then update the pieces-parts...


Does anyone know of another compiler for the x64 platform?
Has anyone gone though and installed MinGW to support x64?

Is This A Good Question/Topic? 0
  • +

Replies To: Compiler for 64bit

#2 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: Compiler for 64bit

Posted 20 March 2008 - 09:11 AM

I see I am a lone trooper on this! :)

Well I have downloaded the win SDK for win64, and it *seems* to have a command line compiler capable of generating x64 code. Right now I am trying to get Eclipse to use it... I thought this would be easy since eclipse just uses make... but I was oh so wrong.

When I try to compile at the command line (basic hello world program) I get a ton of warnings I have never seen before about iostream and exception handling, and then the linker can't find any libraries (even though I told it where to look).


...I had forgotten how frustrating all of this can be :)
Was This Post Helpful? 0
  • +
  • -

#3 GWatt  Icon User is offline

  • member icon

Reputation: 264
  • View blog
  • Posts: 3,059
  • Joined: 01-December 05

Re: Compiler for 64bit

Posted 20 March 2008 - 09:18 AM

use linux?
Was This Post Helpful? 0
  • +
  • -

#4 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: Compiler for 64bit

Posted 20 March 2008 - 09:25 AM

I may just end up working in linux... The problem is that I am interested in doing graphics and VMWare really does not have very good support for OpenGL/DirectX so I really wanted to work on the windows system.

all I have to do is get 1 darn compiler working... well... then I have to get OpenGL or DirectX to work with the compiler (that should not be as hard).
Was This Post Helpful? 0
  • +
  • -

#5 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: Compiler for 64bit

Posted 20 March 2008 - 12:24 PM

Getting there... I got the compiler to produce code for the IA64... just need to find out how to make that AMD64 and I will be good to go...
Was This Post Helpful? 0
  • +
  • -

#6 letthecolorsrumble  Icon User is offline

  • Student of The Sun
  • member icon

Reputation: 27
  • View blog
  • Posts: 555
  • Joined: 07-November 07

Re: Compiler for 64bit

Posted 20 March 2008 - 12:47 PM

By AMD64 you mean to x64 right? You might want to have a look at this,
How to: Configure Visual C++ Projects to Target 64-Bit Platforms, if you haven't already?

And, some link I found on Wikipedia about the issues with C++ and 64-bit might come handy.
Was This Post Helpful? 0
  • +
  • -

#7 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: Compiler for 64bit

Posted 20 March 2008 - 01:31 PM

Got it... mostly it was just a question of getting all the right components.

Just in case anyone else is ever doing this:

Install the platform SDK for x64.
Install eclipse
Ensure you add:
(sdk install path)\bin;(sdk install path)\bin\win64\x86\AMD64

to your path.

then set your default build tool to "nmake"

and use something like this for your makefile (the directories may have to change to match your install):

INCLUDES = "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\crt"
LIBS = "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib\AMD64"
 
CC = "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin\win64\x86\AMD64\cl" 
CFLAGS = /c /EHsc

LINK = "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin\win64\link"

all : HelloEclipse
 
HelloEclipse : HelloEclipse.obj
	$(LINK) HelloEclipse.obj /LIBPATH:$(LIBS) bufferoverflowU.lib

HelloEclipse.obj : HelloEclipse.cpp
	$(CC) HelloEclipse.cpp $(CFLAGS) /I $(INCLUDES) 
 
clean :
	del *.obj



there are two bits of *magic* in here for me, the first is the compiler switch "/EHsc" which gets rid of a ton of compiler warnings about exception handling.

The next is the inclusion of the library "bufferoverflowU.lib" -- this is due to windows security errors.

Don't ask me to explain exactly why these are needed, I just know that by looking up the compiler errors I was able to get the code compiled.

here is the test code that I compiled:
#include <iostream> 
using namespace std;

int main() {
	cout << "Hello Eclipse!!!" << endl;
	cout << "64bit application!!!" << endl;
	cout << "SizeOf int: " << sizeof(int) * 8 << endl;
	cout << "SizeOf int*: " << sizeof(int*) * 8 << endl;
	cout << "SizeOf long: " << sizeof(long) * 8 << endl;
	cout << "SizeOf long*: " << sizeof(long*) * 8 << endl;
	cout << "SizeOf long long: " << sizeof(long long) * 8 << endl;
	cout << "SizeOf long long: " << sizeof(long long*) * 8 << endl;
	return 0;
}

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1