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
Solved

File extensions for C++ whats the difference?

Posted on 2004-08-12
5
264 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

856 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