Loading...


bookmark - Did I Install A C Or A C++ Compiler ? A simple way to see the difference

Did I Install A C Or A C++ Compiler ? - A simple way to see the difference

 
 Discussion by yordan with 6 Replies.
 Last Update: September 8, 2008, 10:51 pm
 
bookmark - Did I Install A C Or A C++ Compiler ? A simple way to see the difference  
Quickly Post to Did I Install A C Or A C++ Compiler ? A simple way to see the difference w/o signup Share Info about Did I Install A C Or A C++ Compiler ? A simple way to see the difference using Facebook, Twitter etc. email your friend about Did I Install A C Or A C++ Compiler ? A simple way to see the difference Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

If you already had the same problem I just experienced, you should probably be interested by this trick.
I just installed a compiler, and I wanted to know if I installed the C and the C++ compiler, or only the C compiler.
The answer is simple : let's use small sample programs.
Everybody know the well-known "hello" world C program, it compiles with a standard C compiler.

CODE

main ()
{
printf("Hi, Folks, what s new");
}


And here is a sample C++ "hello world" program :

CODE

#include <iostream.h>
main()
{
cout << "Hello World!";
return 0;
}

The second sample program compiles only with a C++ compiler, the standard C compiler gives an error for the "cout" syntax.
So, using these two small pieces of code allows you to check that you have both the standard C and the C++ compilers.
Hope this helps you as it helped me.
Regards
Yordan

   Wed May 23, 2007    Reply         

Haven't used those compilers that were meant only for C or only for C++. The ones I tried usually compiles both, but that's definitely a good thing to know. Even Borland's Turbo C++ (name implies that it's a C++ compiler) works with the C language B)

   Wed May 23, 2007    Reply         

QUOTE (WeaponX)

Haven't used those compilers that were meant only for C or only for C++. The ones I tried usually compiles both, but that's definitely a good thing to know. Even Borland's Turbo C++ (name implies that it's a C++ compiler) works with the C language B)
Link: view Post: 103877


Yep - all C++ compilers are supposed to be backward compatible, i.e. be able to compile C code as well. That is a standardised rule.








   Wed May 23, 2007    Reply         


QUOTE (miCRoSCoPiC)

Yep - all C++ compilers are supposed to be backward compatible, i.e. be able to compile C code as well. That is a standardised rule.
Link: view Post: 103892

Yes, and the trap is that C-only compilers won't compile C++ programs. So, if you prepare a system for somebody else, you should better verify it before calling your collegue, or you will have to pay an apologizing beer.
By the way, I wrote this in the "How-To's" section, because there is no "Tricks and Tips" section.

   Thu May 24, 2007    Reply         

You forgot your namespaces! It probably won't compile with most compilers to begin with now.

   Sun Sep 7, 2008    Reply         

QUOTE (tombert)

You forgot your namespaces! It probably won't compile with most compilers to begin with now.
Link: view Post: 128064

Practically speaking most of the compilers are built to compile both C and C++ programs. You will hardly find any compiler only meant for C only..

   Mon Sep 8, 2008    Reply         


you can find older compilers which will only compile C language and won't understand C++ but these days I also believe you can hardly find one, unless it's a custom one made but some guy which is open-source, but use the same tools.. If your code can compile C++ it really can compile C language..

the difference I saw with using different compilers, both seem to compile the same little code, but the executable files are much bigger in size of bytes when compiling with Microsoft Visual Studio, when a simple other compiler from the Internet, they seem both to work the same, I remember in the old days people/programmers managed to create really very cool programs or demos (graphics show) in size of 4kb or 16kb now even a hello world is ~240kb ;)

   Mon Sep 8, 2008    Reply         

Quickly Post to Did I Install A C Or A C++ Compiler ? A simple way to see the difference w/o signup Share Info about Did I Install A C Or A C++ Compiler ? A simple way to see the difference using Facebook, Twitter etc. email your friend about Did I Install A C Or A C++ Compiler ? A simple way to see the difference Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Similar Topics:

How To Install SMF

This guide will show you how to install an SMF forum in the event that you do not have Fantastico or cannot, for some reason, install SMF from it. Step 1: The first step is to make sure you have access to a MySQL database and enough rights for it (I don't know ex ...more

   19-Jun-2005    Reply         

How To Install Windows XP In 5 Hour...

My Windows XP installation has reached its half-life. (You do know that Windows has a half-life, don’t you? Every installation of Windows naturally degrades along a logarithmic curve until it becomes annoying, then unbearable, then unusable. Each successive revision of Windows has featured a slightl ...more

   14-Aug-2006    Reply         

Installing Glut To Dev C++

This is a tutorial that someone submitted to my programming site when it was up because I didn't know how to install glut on any other compiler than my own. I though it would be helpful to post this up for everyone here so they can use GLUT as well without having to google for hours. I'm n ...more

   26-Nov-2006    Reply         

C++: Basic Classes classes, objects, access labels, members, inline functions   C++: Basic Classes classes, objects, access labels, members, inline functions (10) (0) Sorting A String Vector   Sorting A String Vector