LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-04-2005, 01:30 PM   #1
Phoenix2206
LQ Newbie
 
Registered: Jan 2005
Location: Kent, England
Distribution: SuSE 9.1 64 bit, FreeBSD 5.3 64 bit
Posts: 18

Rep: Reputation: 0
64 bit


If I compile a program under a 64 bit OS and compiler, is the program 64 bit?
 
Old 01-04-2005, 01:56 PM   #2
leadazide
Member
 
Registered: Apr 2004
Location: Germany
Distribution: SuSE 11.0, Ubuntu 7.10
Posts: 390

Rep: Reputation: 30
I think yes, if you're not cross-compiling.
 
Old 01-04-2005, 02:31 PM   #3
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 43
I would guess that it's 64 bit iff sizeof(void*) is 8. That should be a quick way to check : )
 
Old 01-04-2005, 03:31 PM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
That depend on the compiler you are using, if it only supports 32 bits, it will obviously only generate 32 bits binaries.
If you are using a recent compiler, it will generate 64 bits code on a 64 platform, unless you specify -m32 (or equivalent) on the command line.
Reciprocally, you should be able to compile 64 bit code on a 32 bit O/S with the -m64 option.

Use the "file" command on a binary or a library to see whether its 32 or 64 bits.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Which version of 32 bit redhat will install on IBM xSeries 366 (64 bit)? Hello123 Linux - Hardware 2 09-14-2005 05:50 AM
how do i compress an existing mp3 from 128 bit to 32 bit? lemuel Linux - Newbie 4 01-04-2005 08:28 PM
C, read 8 bit octal numbers, convert to 24 bit binary bamalabs Programming 3 01-20-2004 09:59 AM
Graphic Card that Supports displaying 8-bit and 24-bit images simultaneously yrraja Linux - Hardware 2 04-30-2003 06:41 AM
Displaying 8-bit images in 24-bit mode and vice versa yrraja Linux - General 4 04-29-2003 11:54 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration