Thread: How do you create exes from your c++ program?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Anubis208 View Post
    im using windows, how would you link and compile?
    "cl" is the Microsoft Visual Studio compiler. Given a single (but complete) source file, it will compile and link the source for you in one step. Of course, if the complete project is not in one file, you either have to give multiple source files to the compile command, or, if you have MANY files to compile, you'd have to compile one or a few files at a time, and link later.

    You should really know how to do that if you are capable of writing an application that generates C++ code. How do you compile that?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  2. #2
    Registered User
    Join Date
    Sep 2007
    Posts
    18
    in order to compile it, I would open it up in some ide (i use Dev-C++) and compile it.
    i am a noob when it comes to the detailed stuff about compiling code. I want to package mingw with my program. I think I can figure it out, but help would be appreciated. I'll tell you if I do figure it out

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Ok, so
    Code:
    system("g++ -o myprog.exe myprog.cpp");
    You do realize that packaging gcc-mingw WITH your package is probably not a great idea. It's likely better that you put a link to where a suitable gcc-mingw can be found on your download page.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by matsp View Post
    Ok, so
    Code:
    system("g++ -o myprog.exe myprog.cpp");
    You do realize that packaging gcc-mingw WITH your package is probably not a great idea. It's likely better that you put a link to where a suitable gcc-mingw can be found on your download page.
    Are there licensing issues or are you thinking it will be too large? Or both? :-)

    Personally, I don't like software that asks me to download other software. At the very least, I'd provide an installer that downloads it for them, but I'd prefer to bundle everything they need.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by medievalelks View Post
    Are there licensing issues or are you thinking it will be too large? Or both? :-)

    Personally, I don't like software that asks me to download other software. At the very least, I'd provide an installer that downloads it for them, but I'd prefer to bundle everything they need.
    Licensing is one thing, size is another. There are plenty of places you can get gcc-mingw, and many may already have a copy installed already - no point in downloading a few extra megs for that. [Or have two packages, one with or one without to solve that particular problem].

    The licensing gets more interesting. If you provide gcc-mingw binaries, you also have to provide the source-code.

    The best option, of course, is to just provide a package that allows the user to use whatever compiler he/she likes [within some reason, of course] - then just tell the user that they will need one of these <some list of compiler> - candidates for that list are recent Visual Studio releases and gcc-mingw.

    There should be little reason (other than "how do I compile" that changes between compilers as long as the generated code is reasonably standards compliant, so why force the user onto a particular compiler.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by matsp View Post

    There should be little reason (other than "how do I compile" that changes between compilers as long as the generated code is reasonably standards compliant, so why force the user onto a particular compiler.
    It depends on the target market. The users may not be programmers at all. They're just pushing buttons, dragging and dropping, and kicking screensavers (or whatever) out the back.

    It also depends on what the developer tested with. Generated code that compiles with MinGW may not with VC++, or vice versa.

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by medievalelks View Post
    It depends on the target market. The users may not be programmers at all. They're just pushing buttons, dragging and dropping, and kicking screensavers (or whatever) out the back.

    It also depends on what the developer tested with. Generated code that compiles with MinGW may not with VC++, or vice versa.
    Sure, target market will decide what is the best option.

    Yes, of course, the developer will need to test with both, because code that compiles with one may not compile with the other, and even if both happily compiles it, doesn't mean that it runs perfectly from both.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  8. #8
    Registered User
    Join Date
    Sep 2007
    Posts
    18
    MinGW is too large to package with my program. how would I go about makeing "my own language"? I want people to be able to run the generated programs on systems without my program installed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 06:23 AM
  3. How to create a file association program?
    By eShain in forum Windows Programming
    Replies: 1
    Last Post: 03-06-2006, 12:15 PM
  4. Trying to create a payroll calculation program
    By nadeni0119 in forum C++ Programming
    Replies: 1
    Last Post: 04-01-2003, 04:14 PM
  5. program won't create status bar
    By Unregistered in forum Windows Programming
    Replies: 7
    Last Post: 08-30-2001, 04:00 PM