How to compile C++ code in C#?

Post your questions regarding programming in C# in here.
9 posts Page 1 of 1
Contributors
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

How to compile C++ code in C#?
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 :D
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Re: How to compile C++ code in C#?
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.
You do not have the required permissions to view the files attached to this post.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

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.
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: How to compile C++ code in C#?
mandai
What runtime are you trying to use?
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

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?
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: How to compile C++ code in C#?
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.
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

Yes, just Windows.

How can I use this "cl.exe"? Code?
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Re: How to compile C++ code in C#?
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.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
DreadNought
VIP - Donator
VIP - Donator
Posts: 116
Joined: Fri Jan 08, 2010 12:37 pm

.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?
Bound and boom tech,
The Future Of Coding
9 posts Page 1 of 1
Return to “General coding help”