Rafik Bari
Rafik Bari

Reputation: 5037

How can I compile C source code using Emabarcadero C++?

I am wondering if it is possible for me to use Embarcadero c++ 2010 in order to compile a source code which i got from internet. I have this software installed in my PC, and i don't know to download a c compiler because i think it is already possible to do that using embarcadero.

I clicked on File -> New -> Other -> C Document

But the problem is when i typed my C code inside, i didn't get to click on the Compile button ( The green button ) because it is disabled. Can you help me compile a C source code using embarcadero c++ ?

Upvotes: 0

Views: 1415

Answers (3)

Lundin
Lundin

Reputation: 214810

  • You need to create a .c file and add it to a project. Most likely New->Other->Console application.
  • Pick C as source type.
  • Don't click VCL.
  • Click multithreading if your program is using it.
  • Click "Console application" if your project is a text based console application of the usual int main(void) format. If it is a Windows API application with windows, don't click console application.
  • You can specify project source if you already have a main() file, otherwise the IDE will create one for you.

Upvotes: 3

Richard J. Ross III
Richard J. Ross III

Reputation: 55583

As far as my knowledge goes, C++ is a superset of C, meaning all most code that is valid in C is valid in C++. Just rename your .c files to .cpp and see if it works.

Note that some problems may persist with naming of variables (class, private, etc. Are valid variable names in C, but in C++ they will throw a compiler error), but for the most part this should work.

Upvotes: 0

crashmstr
crashmstr

Reputation: 28583

Given that this Embarcadero product looks like a full featured IDE, you probably need to start with a project, probably console based (depends on the code you downloaded).

Then you would add the C code to the project.

If you don't have a project, the IDE is not going to know how you want the results: library, DLL, console application, windowed application, etc.

Upvotes: 2

Related Questions