Can I use a Mac to create a PC application?

This is a discussion on Can I use a Mac to create a PC application? within the C++ Programming forums, part of the General Programming Boards category; This post is generated by a total newbie to C++. I'm really curious to know if I develop an application ...

  1. #1
    Registered User
    Join Date
    Sep 2009
    Location
    Ellicott City, MD
    Posts
    3

    Can I use a Mac to create a PC application?

    This post is generated by a total newbie to C++.

    I'm really curious to know if I develop an application on my Mac; will there be any reason that I couldn't run the app on a PC?

    It's my understanding that the development tools for the platforms may differ: although a program should be able to be compiled for use on multiple operating systems. Do I understand this correctly?

    Thank you for any feedback. This bit of information will help me make a first major decision about how I'd like to move forward in learning C++.

    Sincerely,

    Joseph
    Last edited by josephaboothii; 09-28-2009 at 08:08 AM. Reason: fixed grammer

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    242
    I haven't tried anything on a Mac but am pretty sure this is correct:

    The CODE, if correct, will normally work on both systems, but you have to compile it to run it--i.e., the compiled executable file for PC isn't going to work on a Mac and vice-versa. So, in answer to your question, the app won't run unless you take the source code and recompile it on the other system.

    I'm pretty sure that's right, and if not, one of the experts here will surely correct me.

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    By default everything is set up for "native" architecture -- i.e., you are building an executable for the machine you are compiling on. But you can set things up for cross-compiling, i.e., building an executable for some other machine. (This is necessary for things like embedded systems which may not have a compiler on them.) Setting this up is not exactly for the faint of heart; for instance you could see here: MinGW cross compiler for Linux build environment | MinGW (this says Linux but I'm pretty sure holds true for the Mac as well).

  4. #4
    Registered User
    Join Date
    Sep 2009
    Location
    Ellicott City, MD
    Posts
    3
    Quote Originally Posted by Aisthesis View Post
    I haven't tried anything on a Mac but am pretty sure this is correct:

    The CODE, if correct, will normally work on both systems, but you have to compile it to run it--i.e., the compiled executable file for PC isn't going to work on a Mac and vice-versa. So, in answer to your question, the app won't run unless you take the source code and recompile it on the other system.

    I'm pretty sure that's right, and if not, one of the experts here will surely correct me.
    This is what I interpretted as well through sites and books. I haven't taken the plunge on either a Mac or PC yet; still reading as much information as I can to better understand C++ before I start down a development path. For me it's better to do a bit of research before I head in a particular direction; this saves me from wasting time once I get involved in a project. I'd hate to complete something only to find out at the end that it's stuck to a single system. That would be bad in my world.

    My preference is to work on a Mac although I know the users I'm targeting for an application are solely on PCs. With this thread I hope to achieve confirmation of the Mac as the development environment and the PC as the target platform for the application.

    Thank you both for the information.

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    242
    You're making it more difficult for yourself than is necessary if you develop on a Mac when your target platform is PC.

  6. #6
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    435
    Even if you manage to compile Windows binaries on apple, how will you test them?

    You're either going to need to dual boot or run Windows in a VM or maybe even a remote desktop.
    I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo

  7. #7
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Looke here

  8. #8
    Registered User
    Join Date
    Sep 2009
    Posts
    63
    He could also use Wine to test his binaries. I do that for the simple mod tools I write when I'm on Linux, but I always try to make sure to test the stuff under some version of Windows before I let it loose.

    You could try using some version of MinGW or Cygwin or something like that to cross-compile your apps for Windows. I've never tried it with a Mac, but I do so in Linux regularly. And when I do use Windows for development, I typically use MinGW + GCC, simply because I am more familiar with GCC. Though I have to admit, I do like the newer MSVC compilers, too.

  9. #9
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,832
    Here is the concept that hasn't been mentioned:
    Universal binary - Wikipedia, the free encyclopedia
    Apple's Xcode can generate these.

  10. #10
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    Quote Originally Posted by nonoob View Post
    Here is the concept that hasn't been mentioned:
    Universal binary - Wikipedia, the free encyclopedia
    Apple's Xcode can generate these.
    That binary is only universal among (2) CPU architectures. It is not universal among operating systems which is what the OP is asking for.
    bit∙hub [bit-huhb] n. A source and destination for information.

  11. #11
    Registered User
    Join Date
    Sep 2009
    Posts
    37
    doesnt it depend on the exe header?
    the code should be interpreted same exept windows api functions because they wont be available in mac sys

    binary = binary whatever all are binarys

    btw u can code the same programm just replace the windows header with linux or mac headers. with #ifdef ..??:?
    but u need to recompile it on the other sys there is also on sourceforge a crosscompiler wich can compile exe on linux.

  12. #12
    Registered User
    Join Date
    Sep 2009
    Location
    Ellicott City, MD
    Posts
    3

    Wow! You guys are great.

    Thank you all for dropping these bits of knowledge upon me. This is really helping.

    This is what I'm thinking to move forward. I'm going to put together a modest PC in which to code for the audience I know I'm trying to reach. As I develop my skills into the future: I'll begin to learn the specifics of working on my mac for a pc app.

    To me this seems to make the most sense based on some of the responses you guys have posted here. I am new and I don't need to make the workflow any more difficult than I have to.

    Thank you, thank you.

    Joseph

  13. #13
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,274
    Quote Originally Posted by Aisthesis View Post
    You're making it more difficult for yourself than is necessary if you develop on a Mac when your target platform is PC.
    I don't see why that's true. For 10 years I developed Windows software using a Linux workstation. There were a lot of reasons for that, but making my life more difficult wasn't one of them.

    As it happened, the code could compile on Linux (we had an old X11 GUI implementation that laid on top of it) and I managed to spend 90% of my time never even touching a Windows machine. I even debugged the thing primarily on Linux.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. First time Creating Win32 application with UI
    By chiefmonkey in forum Windows Programming
    Replies: 9
    Last Post: 09-23-2009, 12:44 PM
  2. MFC run application by clicking on file...
    By dug in forum Windows Programming
    Replies: 4
    Last Post: 12-02-2004, 04:33 AM
  3. Application Utilization on Win PC
    By compiler in forum Tech Board
    Replies: 1
    Last Post: 07-23-2003, 05:39 AM
  4. Mac programming?
    By Luigi in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 02-07-2003, 09:37 PM
  5. Win application not very portable
    By swed in forum Windows Programming
    Replies: 5
    Last Post: 10-01-2001, 12:17 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21