Solved

File extensions for C++ whats the difference?

Posted on 2004-08-12
5
232 Views
Last Modified: 2010-05-18
Hi,
What is the difference between *.cpp files and *.cc files? I know both are used for writing C++ source code but then why two extensions? Is it the compiler that we can use to compile those files? If yes then what are the differences. Are there any other extensions we can use for C++ File?
Thanks.
0
Comment
Question by:dkamdar
5 Comments
 
LVL 6

Accepted Solution

by:
SCDMETA earned 50 total points
ID: 11787584
C source files often had a .c extension.
C++ source files often had a .C extension.  Notice uppercase.  

But some OS's don't differeniate between upper and lower case files names thus new extensions were created .cpp, .cc, cxx.
.C, .cpp, .cc, .cxx are just text files containing C++ source code. The extension of choice was dependant on the compiler or the standard for the operating system.
0
 
LVL 4

Expert Comment

by:y1381
ID: 11787673
.cc generate comes from gcc which is common compiler for c++ over linux / unix ..
.cpp comes from the other windows versions of the compilers ..

0
 

Author Comment

by:dkamdar
ID: 11787797
So which one is interoperable?
.cpp and .cc works on unix (solaris)
.cc will not work under win32 environment?

And which compilers will compile .cc and .cpp files also are they cross compilable?
e.g. can gcc compile .cc, .cpp and .cxx files?
also is g++ next version or altogather a different compiler than gcc?

Thanks for earlier responses.
0
 
LVL 6

Expert Comment

by:SCDMETA
ID: 11788433
.C, .cpp, .cc, .cxx are just text files containing C++ source code.

If the C++ code conforms to some standards (e.g. ANSI C++) and doesn't use features specific to the compilier, operating system, or dependent on external libraries that have dependanceis, then yes they are interoperable.  This assume the compiliers for the various systems you try support the same standard.  You need to check the documentation for the specific complier to see what standards it complies with.
0
 
LVL 9

Expert Comment

by:_ys_
ID: 11792148
> And which compilers will compile .cc and .cpp files also are they cross compilable?
As long as the contents are legitimate the file extension makes no difference - a custom makefile could be set up to compile a .txt file as C++.
Although it's much better to give them meaningful extensions.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Exchange and Third Party application. 8 59
countHi challenge 25 84
groovy example issue 10 66
oracle query help 18 78
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now