Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bursty

macrumors 65816
Original poster
Jan 31, 2004
1,002
5
I am forced to take a basic C++ class for my Engineering degree, but I cant stand the ancient Windows machines they have in the computer lab. What are some free compiler options for my PB? I would prefer freeware just because after this semester, I doubt I would ever use C++ again. Any suggestions? :)
 

bousozoku

Moderator emeritus
Jun 25, 2002
15,549
1,702
Lard
The Apple developer tools, Xcode, are free.

They should be in the Install folder within your Applications folder.
 

slooksterPSV

macrumors 68040
Apr 17, 2004
3,543
305
Nowheresville
bursty said:
I am forced to take a basic C++ class for my Engineering degree, but I cant stand the ancient Windows machines they have in the computer lab. What are some free compiler options for my PB? I would prefer freeware just because after this semester, I doubt I would ever use C++ again. Any suggestions? :)
Personally I think GCC is the only C++ compiler out there. Funny I know, seriously, I second XCode, its awesome, just learn the environment. I do a lot with it in my spare time.
 

bursty

macrumors 65816
Original poster
Jan 31, 2004
1,002
5
bousozoku said:
The Apple developer tools, Xcode, are free.

They should be in the Install folder within your Applications folder.
And these will compile programs that will transfer over to my professors Windows machine and compile in Visual Studio no problem? If so, thats amazing. They wanted me to drop ~$200 on Visual Studio. :rolleyes:
 

Thomas Harte

macrumors 6502
Nov 30, 2005
400
4
GCC & the XCode toolset fully support the standard C and C++ languages. MSVC still didn't have complete C++ compliance last time I used it, but that was some time ago. In any case, the deviations are small and adapting "proper" C++ code takes a very small amount of time.

There are also versions of GCC for Windows such as MingW32. There aren't any IDEs as nice as XCode, but there are several that are usable. I'm no expert so I don't want to suggest anything.

What you obviously won't be able to do is develop programs that are intended to use Microsoft's specific Windows libraries, which roughly means anything that performs operations you wouldn't expect a text based operating system to perform. There are third party libraries that let you do things like create and manipulate windows in sufficiently generic ways to build on both Mac and Windows, but I suspect they'll be outside of the realm of your course.

So, it really depends what your course is about. If it is more about the normal language without any Microsoft extensions - e.g. data processing, manipulation, advanced calculations, etc - then you won't have any problem. If it starts to head into "we're going to design our window here, then make it work by writing this code..." or "we'll display the output in a simple message box" then you probably won't be able to use a Mac for development - but it is still worth looking into the Windows versions of GCC.
 

balamw

Moderator emeritus
Aug 16, 2005
19,366
979
New England
bursty said:
And these will compile programs that will transfer over to my professors Windows machine and compile in Visual Studio no problem? If so, thats amazing. They wanted me to drop ~$200 on Visual Studio. :rolleyes:
:eek: :confused: :eek:

If you want full compatibility with VS and don't want to pay for it, just stick with the FREE Microsoft VC++ toolkit, which is the same compiler they use in VS, without the VS IDE and GUI frameworks. http://msdn.microsoft.com/visualc/vctoolkit2003/ Of course that won't run on your PB without VPC. ;)

I too only think of gcc as the one true C/C++ compiler. Thank god it's built in in Xcode.

B
 

bousozoku

Moderator emeritus
Jun 25, 2002
15,549
1,702
Lard
bursty said:
And these will compile programs that will transfer over to my professors Windows machine and compile in Visual Studio no problem? If so, thats amazing. They wanted me to drop ~$200 on Visual Studio. :rolleyes:

It depends on what they're trying to do with it.

If you write standard programmes (without any GUI, DOS, or Mac/Windows-dependence), even Visual Studio shouldn't have a problem with all optimisations turned off there.
 

bursty

macrumors 65816
Original poster
Jan 31, 2004
1,002
5
The programs are very simple, such as the one I am working on now:

Write a program that writes to a file, projectile.txt, a table that shows the height of a projectile launched straight up, for each second from launch time (time zero) until the projectile hits the ground. The last entry in the table should show a projectile height of 0. The height after t seconds is given by:

S = Vot -1/2gt^2

Very basic, easily coded in a few minutes but it does use Command Prompt in Windows, which is why I wasnt sure if OSX has a similar Command Prompt (maybe Terminal or something? :confused: ) I guess I will just open up Xcode and see what happens.
 

balamw

Moderator emeritus
Aug 16, 2005
19,366
979
New England
bursty said:
Very basic, easily coded in a few minutes but it does use Command Prompt in Windows, which is why I wasnt sure if OSX has a similar Command Prompt (maybe Terminal or something? :confused: ) I guess I will just open up Xcode and see what happens.
Yes. Terminal = Command Prompt.

You don't need Xcode for this, just use vi and gcc from within Terminal and become one with your unix side. ;)

B
 

bursty

macrumors 65816
Original poster
Jan 31, 2004
1,002
5
Got everything working and got my program to compile and run unaltered, which I had running on Windows earlier, which is great news! Thanks for the help! :)
 

jalagl

macrumors 6502a
Jun 5, 2003
802
1
Costa Rica
If you're developing for Windows, you can also download Microsoft's Platform SDK. It has all the compilers, linkers, etc that you need to create Windows programs.

It doesn't include an IDE, though...
 

mwpeters8182

macrumors 6502
Apr 16, 2003
411
0
Boston, MA
jalagl said:
If you're developing for Windows, you can also download Microsoft's Platform SDK. It has all the compilers, linkers, etc that you need to create Windows programs.

It doesn't include an IDE, though...

I think the platform SDK still requires a compiler. If you're using visual studio in class, and you've got a windows computer, I'd download Visual C++ express, which is free for a year.
 

bousozoku

Moderator emeritus
Jun 25, 2002
15,549
1,702
Lard
bursty said:
Got everything working and got my program to compile and run unaltered, which I had running on Windows earlier, which is great news! Thanks for the help! :)

If you have something that doesn't compile, saying that something can't be found, it's usually that people have tried to use DOS C bindings with header files like conio.h and dos.h. As long as you stay away from that sort of thing, you should be fine.
 

balamw

Moderator emeritus
Aug 16, 2005
19,366
979
New England
mwpeters8182 said:
I'd download Visual C++ express, which is free for a year.
Thanks for reminding me about that! Note that it's not free for 12 months of usage, but it is free if you download it before November 7, 2006.

http://msdn.microsoft.com/vstudio/express/support/faq/#pricing
12. Do customers who acquire the Visual Studio Express products during the free promotional pricing period have to pay after the first year if they want to continue to use them?

No, as long as you download Visual Studio Express on or before November 7th 2006, you will not have to pay for it.

B
 

mwpeters8182

macrumors 6502
Apr 16, 2003
411
0
Boston, MA
balamw said:
Thanks for reminding me about that! Note that it's not free for 12 months of usage, but it is free if you download it before November 7, 2006.

http://msdn.microsoft.com/vstudio/express/support/faq/#pricing


B

Good to know, that's a change from what they originally had planned. A good idea by MS, if you ask me. That's the nice thing about the Mac platform - the developer tools are free. These aren't the full thing, but good for hobbyists/beginners
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,565
bursty said:
I am forced to take a basic C++ class for my Engineering degree, but I cant stand the ancient Windows machines they have in the computer lab. What are some free compiler options for my PB? I would prefer freeware just because after this semester, I doubt I would ever use C++ again. Any suggestions? :)

As others said, XCode is free. http://www.metrowerks.com used to have a free download of the CodeWarrior compiler (limited to 32 files, no optimisation), but that seems to be gone.
 

bigmat1201

macrumors member
Apr 21, 2008
65
0
Houston
in my opinion Xcode is really hard to use, unless you really know what your doing, and most of the features it has your never going to use, or even understand what there for. An easier IDE to learn and use is Netbeans. Thats what I use, its free to download. Another mac IDE is eclipse.
 

MacRumors Guy

macrumors member
Sep 17, 2008
82
0
In my opinion any piece of software is hard to use if you don't know what you are doing, and netbeans and eclipse have much more features than XCode.
 

FreeLunch1

macrumors member
Jun 9, 2008
57
3
xcode compiler

I posted in the iphone programming section thinking that it was the right place. However, this thread seems more applicable.

Since the wiki said to learn C first, I bought the C programmign guide and wanted to do the exercises in xcode while writing C.

Is there a guide out there describing how to compile programs in xcode written in C?

thanks..
 

appledyl

macrumors regular
Apr 20, 2009
117
0
USA
Xcode!!!

Xcode all the way! It's on your mac disk or on hard disk. If you don't have it then download it online for free. You just need to make a special Apple Developer Community ID. WONDERFUL PROGRAM!!!!
 

sover435

macrumors newbie
Jun 13, 2011
2
0
The Apple developer tools, Xcode, are free.

They should be in the Install folder within your Applications folder.

um these are not free you have to sign up and pay to use them... can some one explain what im doing wrong????
 

subsonix

macrumors 68040
Feb 2, 2008
3,551
79
can some one explain what im doing wrong????

Yes I can, you are responding to a 5 year old thread. The latest version of Xcode is $4.99 on the Appstore, I don't think you have to sign up to get it from there. But, you have Xcode on your OS X install disk.
 

balamw

Moderator emeritus
Aug 16, 2005
19,366
979
New England
Yes I can, you are responding to a 5 year old thread.

ROFL ;) Any thread where PPC was still the norm should probably not get added to.

The latest version of Xcode is $4.99 on the Appstore, I don't think you have to sign up to get it from there. But, you have Xcode on your OS X install disk.

Correct:

Xcode 4 is $4.99 from the Mac App Store.

Xcode 3 is usually available on your OS X install disc, and is also available from Apple Developer Connection as a free download.

Down in the bottom right of the page here: http://developer.apple.com/xcode/ you will find a link that says "Looking for Xcode 3". Click that and register for a free ADC account using the "join now" link on that page.

B
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.