English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

does a c source code run on visual c++ compiler?

2007-03-24 01:26:39 · 5 answers · asked by jontro 1 in Computers & Internet Programming & Design

i mean i dont have any knowledge abot c++,but i know c
so can my source codes(mainly written in turbo c) run on visual c++ compiler?

2007-03-24 01:28:05 · update #1

5 answers

In general, yes...

C++ is a superset of C... The name is supposed to be a pun! (One better than C... get it?)

There are always slight variations between compilers, so some minor tweaking MIGHT be needed; but usually they just run as-is!

2007-03-24 01:30:43 · answer #1 · answered by N2FC 6 · 3 0

Visual C++ also comes with a C compiler. This is generally true for all C++ compiler sets. THey are usually both a C and C++ compiler combined.

You may have to modify your Turbo C code to work on Visual C++. As long as you use portable standard C code, you're good, but if you relied on Turbo C proprietary extensions, you're in trouble.

I can't believe how many people repeat the same mistake, so to correct others:

@N2FC:
In general, you don't know. It could be minor tweaking or major code rewriting.

@CinderBlock:
No, C++ is not C extended. It's an entirely different language. No, C++ isn't just C with classes. Clearly, you have never heard of templates and generic code.

If you wrote proper code, it shouldn't matter what the size of an int is, right?

People, please look at http://david.tribble.com/text/cdiffs.htm . If you think non-trivial C code works as is on C++ compilers, you are mistaken.

2007-03-24 02:42:50 · answer #2 · answered by csanon 6 · 0 0

In general, you can use a C++ compiler to compile C programs. C++ is an extension of C. Think of it as a standard C compiler with additional support that lets it parse and compile object-oriented source statements. C++ source code looks very similar to Java.

Whether your programs will compile or not will depend on how old your version of Turbo C is. I have used Turbo C 1.5 for DOS since I first bought it in the early 1990s. In that version, an integer (int) is only two bytes. I've never used Visual C++, but I'm sure it uses 4-bytes as the default size for an int. The interfaces to C library routines have changed a bit too over the years. I've had mixed results compiling some of my old Turbo C 1.5 programs using gcc on Linux.

Good luck!

2007-03-24 02:06:47 · answer #3 · answered by CinderBlock 5 · 0 0

it particularly is real that in case you create an empty C++ console undertaking and manually rename your cpp record to grant it .c extension, seen Studio *will* execute the Microsoft C compiler, inspite of the undeniable fact that it particularly is a doubly-out of date 1989 C compiler. Microsoft deserted C an prolonged time in the past. in case you elect to stay with this IDE and assemble C, exchange the underlying compiler. Intel C/C++ is a good selection.

2016-10-19 12:17:25 · answer #4 · answered by ? 4 · 0 0

if you compile your code as a console app, it should be no problem. to do that, just create a new project and select console application, and a blank application. then just import your code to the new app.

2007-03-24 01:54:27 · answer #5 · answered by justme 7 · 0 0

fedest.com, questions and answers