Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

File extensions for C++ whats the difference?

Posted on 2004-08-12
5
Medium Priority
?
301 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 150 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Screencast - Getting to Know the Pipeline

916 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