Jump to content
  • Advertisement
Sign in to follow this  
NUCLEAR RABBIT

Windows vs. Mac Programming!

This topic is 4354 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Howdy! I am currently learning C++ on my winXP desktop, and am in a hard decision right now. Well, im thinking of buying a mac laptop. 1. The thing is, whats the difference, programming wise between windows XP and mac? 2. How do i create things that would work with both winXP and mac? do i have to create 2 diff projects, or can the same code work on both machines, such as creating a window and stuff like that? 3. After its all said and programmed (haha), would it better for me to stick with windows, or would it be the samething if i get a mac? Any help is greatly appreciated!

Share this post


Link to post
Share on other sites
Advertisement
As long as you avoid platform-specific calls such as those in windows.h, your code should be cross-platform already. Things like creating a window can be done in SDL and be cross-platform, or you can use platform-specific API calls for each platform and wrap them in
#ifdef __WIN32
#endif
#ifdef __APPLE__
#endif

OpenGL can be used on MacOS and Windows, but stay away from DirectX if you want your code to run on a Mac.

Share this post


Link to post
Share on other sites
Quote:
Original post by v0dKA
You and I, we are only seconds apart with a very similar question! [smile]

Might I add, I beat you by 22 seconds [razz]


Damn you! I bet you were watching me outside my window and ran home to post it, just to make me look dumb! [lol]

Quote:
Original post by Driv3MeFar
As long as you avoid platform-specific calls such as those in windows.h, your code should be cross-platform already. Things like creating a window can be done in SDL and be cross-platform, or you can use platform-specific API calls for each platform and wrap them in
#ifdef __WIN32
#endif
#ifef __APPLE__
#endif

OpenGL can be used on MacOS and Windows, but stay away from DirectX if you want your code to run on a Mac.


Thanks for the help.

Also, would system("pause") or system("cls") still work for macs as well?

Share this post


Link to post
Share on other sites
Quote:
Original post by NUCLEAR RABBIT
Also, would system("pause") or system("cls") still work for macs as well?


No. Those are Windows-specific. Macintosh has standard Unix commands. But you probably shouldn't be using the pause command anyway.

Share this post


Link to post
Share on other sites
Might I add, I doubt WinMain() will be WinMain() on a Mac. WinMain(), as you may not know yet, is the application entry point of a Windows program.

I'm not sure what the application entry point would be on other operating systems. UnixMain()? MacintoshMain?

Console programs, however, might have the same entry point main(). But then again, they might not. I never tried programming on different platforms yet.

But anyways, as I mentioned in my own thread, the wxWidgets library is made for the sake of cross-platform portability. But as CoyCash pointed out, the code must be compiled on the actual operating system in order to run on it. Which, if you're developing applications for other people, kind of sucks... . But at least you won't have to change the actual code for each operating system.

I think, other than wxWidgets, you can use SDL for portability. But I haven't used SDL, so again I'm not sure.

Hopefully, now that I've thrown these ideas out here, someone who knows can verify.

Share this post


Link to post
Share on other sites
Quote:
Original post by CoyCash
System() commands will only work on Windows


nonsense!


:~$ cat foo.cpp && ./foo
#include <cstdlib>
int main(int, char**) {
system("cat /proc/version");
return 0;
}

Linux version 2.6.15-26-386 (buildd@terranova) (gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)) #1 PREEMPT Thu Aug 3 02:52:00 UTC 2006


of course "commands" vary from os to os.

Share this post


Link to post
Share on other sites
Quote:
Original post by v0dKA
Might I add, I doubt WinMain() will be WinMain() on a Mac. WinMain(), as you may not know yet, is the application entry point of a Windows program.

I'm not sure what the application entry point would be on other operating systems. UnixMain()? MacintoshMain?

Just main.

Share this post


Link to post
Share on other sites
Quote:
Original post by NUCLEAR RABBIT
Howdy!

I am currently learning C++ on my winXP desktop, and am in a hard decision right now. Well, im thinking of buying a mac laptop.

1. The thing is, whats the difference, programming wise between windows XP and mac?

2. How do i create things that would work with both winXP and mac? do i have to create 2 diff projects, or can the same code work on both machines, such as creating a window and stuff like that?

3. After its all said and programmed (haha), would it better for me to stick with windows, or would it be the samething if i get a mac?

Any help is greatly appreciated!


OK, having purchased a Mac to learn how to develop for it, and this is from a beginner Mac person, so don't hold this sacred (that you do for the people at idevgames.com).

1) Cocoa vs Carbon. You can create C++ tools, but if you want graphics, or your typical window, you'll have to choose one of the frameworks. Carbon is C, Cocoa is Objective C. I've only started using Obj C, so I'm hardly an expert. Certain things are nicer about it, certain things confuse me.

1.5 XCode vs Visual Studio. Well, you do have alternative IDE's & Compilers, but these are the big 2 on the machines. And I'll be blunt here. As much as people give Microsoft grief, Visual Studio is second to none when it comes to development. On the other hand, XCode is free (I can't state anything about the Express Edition of VS, I own a full version, so I don't know how handicapped the EE is). And I find the XCode debugger really isn't that great.

2) Use cross platform libraries. Even with this being said, what you create may not necessarily work right off the bat. There are places where I have to put #ifdef __APPLE_CC__ & #ifdef _MSC_VER

3) Depends what you're after. If you want to learn a new system, getting a Mac can be a great experience. Programs work sort of differently (ie: one instance vs multiple instances). And with bootcamp, you can get Windows on there, so worse comes to worse, you don't lose anything. As for employment opportunities, I really can't help you there. Most likely the windows world is the way to go.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!