Page 1 of 1
How to compile C++ code in C#?
Posted: Sun Jan 29, 2012 4:40 am
by GoodGuy17
Hello,
I want to make a C++ IDE. There is a certain part that I cannot figure out, however.
How can I compile a single source file into an executable?
Simple as possible, please. Pure code would be best, but if I have to download something, I will.
~GoodGuy17

Re: How to compile C++ code in C#?
Posted: Sun Jan 29, 2012 1:26 pm
by MrAksel
I made this little program for you. Source included. It worked fine at my PC, hope it does on yours too. Ive seen some topics about problems with the CppCodeProvider class around on the web.
Re: How to compile C++ code in C#?
Posted: Sun Jan 29, 2012 3:30 pm
by GoodGuy17
It didn't work.
Does it make a difference that I do not have Visual C++ installed?
Also, the C++ code I am compiling is NOT a VC++ file, it is a .cpp file.
Re: How to compile C++ code in C#?
Posted: Sun Jan 29, 2012 4:28 pm
by mandai
What runtime are you trying to use?
Re: How to compile C++ code in C#?
Posted: Sun Jan 29, 2012 5:17 pm
by GoodGuy17
I don't know.
I know of absolutely nowhere to start in compiling the code. I posted here to get an answer altogether. I can code everything else, just not this part.
So, as I said, I don't know to your question, mandai.
Can you write a how-to of the topic title?
Re: How to compile C++ code in C#?
Posted: Sun Jan 29, 2012 7:02 pm
by mandai
The runtime will determine which platforms the program can run on. You will need to know this in order to say what you want to compile.
If you just want to compile for Windows then you can use the cl.exe command line compiler provided by Microsoft.
Re: How to compile C++ code in C#?
Posted: Sun Jan 29, 2012 8:20 pm
by GoodGuy17
Yes, just Windows.
How can I use this "cl.exe"? Code?
Re: How to compile C++ code in C#?
Posted: Sun Jan 29, 2012 8:56 pm
by MrAksel
GoodGuy17 wrote:It didn't work.
Does it make a difference that I do not have Visual C++ installed?
Also, the C++ code I am compiling is NOT a VC++ file, it is a .cpp file.
.cpp and .h files are standard C++ file formats. I don't know what you mean with VC++ files. This compiles C++ source code.
Re: How to compile C++ code in C#?
Posted: Sat Mar 24, 2012 2:19 am
by DreadNought
.cpp = C Plus Plus file, equipvlent to the .cs files in C#
.h = Header files, like header of files.
If you dont understand this bit and your runtime stuff, you really shouldnt be trying to code a C++ compiler in C#, try something a little easier?