Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

File extensions for C++ whats the difference?

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
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 …
Progress

721 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