5

By default Eclipse (CDT) uses .cpp file extension for C++ files. I would like it to use .cc (and .hh) extensions instead but I cannot find such an option anywhere.

edit: To be precise, it creates a .cpp file when I start a new C++ project. Can this behaviour be changed to creating a .cc file?

I would have expected it under Window > Options > C/C++ > File Types, but as far as I can see that doesn't help. I've searched Google and the only page I found explains how to do it in Netbeans. Any help is greatly appreciated!

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
Paul
  • 273
  • 1
  • 3
  • 11
  • You can follow the [instructions given here](http://meta.stackexchange.com/questions/18232/how-can-one-link-merge-combine-associate-two-accounts-users-anonymous-unregiste/73801#73801) to have a moderator merge your accounts. – Cody Gray - on strike Feb 03 '11 at 14:26

3 Answers3

4

The place to enter your extension is in Window → Preferences → General → C/C++ → File Types. Click the New button, enter your extension and select the file association.

ЯegDwight
  • 24,821
  • 10
  • 45
  • 52
ctubbs
  • 41
  • 1
3

Look at Window->Preferences->General->Content Types Browse to the Definition of a C++ Source File and add your file associations.

user229044
  • 232,980
  • 40
  • 330
  • 338
Tom Seidel
  • 9,525
  • 1
  • 26
  • 38
  • Sorry Tom, could you please be more specific? I don't see how this answer provides a solution. – Paul Feb 03 '11 at 16:10
  • In the content types pages you see a tree with all known content-types and their associated file-assocations. Search in that tree for the definition of C++ source files. If you select the entry you can add a certain file assocation (under the tree). There you can add two entries, '*.cc' and '*.hh' – Tom Seidel Feb 03 '11 at 16:42
  • Ok, thanks. These are already filled in. Doesn't solve the problem. – Paul Feb 04 '11 at 09:08
  • 1
    It may be unrelated to the question but it solves my problem. I have files with *.ipp where my namespaces are defined. I can add *.ipp under the list of C++ source files. This forces eclipse to parse *.ipp files as C++ files. Previously these were treated as plain text files. – user592748 Dec 05 '12 at 10:46
2

Was wondering the same and just found this:

How to change the default C++ file extension in Eclipse CDT when creating a new file?

Community
  • 1
  • 1
naumcho
  • 18,671
  • 14
  • 48
  • 59