Solved

File extensions for C++ whats the difference?

Posted on 2004-08-12
5
284 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
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 …
Starting up a Project

617 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