How do you create exes from your c++ program? I want to be able to have a user use a gui to design a program and then create a program that they can run anywhere without my program. How can I do this?
How do you create exes from your c++ program? I want to be able to have a user use a gui to design a program and then create a program that they can run anywhere without my program. How can I do this?
You'll need to compile the C++ code with a compiler suitable for the system you want to run your executable on.
--
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.
If you want a user to customize only GUI you may be interested in the .Net programming based on using Windows Presentation Foundation and XAML
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
To be honest, if you really want the user to be able to build an executable from our environment you will be looking more into designing your own language which means you will have to be familiar with machine code. Alternatively you could make something similar to Java or VB whereby the user creates code that is executed by some sort of intermediary interpreter that you've designed. You could call it, C@ (pronounced "cat")
My program will generate the c++ code. How would you go about having your program compile and link it?
(this is not a question about compiling c++ code; im asking about making other programs with your program. what I want to do would be similar to GameMaker (except not nearly as complex))
You could call the compiler from your application, e.g.Obviously, if you generate multipel source files, etc, you would have to perform a more complex build. You could create a batch-file and then let that perform the compile, for example.Code:system("cl mycode.cpp");
--
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.
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.
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
Ok, soYou 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.Code:system("g++ -o myprog.exe myprog.cpp");
--
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.
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.
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.