Author Topic: How to set .cp extenstion as C++ source file for Codeblocks  (Read 4366 times)

Offline rajin100000

  • Single posting newcomer
  • *
  • Posts: 9
How to set .cp extenstion as C++ source file for Codeblocks
« on: April 30, 2021, 06:51:44 pm »
I recently installed Codeblocks 20.3 and when I run it, there were four options (I forgot the options  :) :)) and I chose third option. Then all files with these extensions changed their logo and default program to open: .cpp, .cxx, .C, .cc and their logo was like this:-

and my question is... How to make Codeblocks think .cp is C++ extension?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: How to set .cp extenstion as C++ source file for Codeblocks
« Reply #1 on: May 01, 2021, 12:59:36 am »
cp is no standard cpp extension...
but if you are on windows you can simply right cklick "open with" set codeblocks as default

Offline rajin100000

  • Single posting newcomer
  • *
  • Posts: 9
Re: How to set .cp extenstion as C++ source file for Codeblocks
« Reply #2 on: May 01, 2021, 10:41:37 am »
But when I set Codeblocks as the default program to open .cp file, it has the logo with codeblocks image, not the logo with c++ logo.
And .cp is a c++ extension as u can see here:


You may think, this extension is only for macOS but it's not! We can still compile .cp files using g++ in cmd.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: How to set .cp extenstion as C++ source file for Codeblocks
« Reply #3 on: May 01, 2021, 03:51:29 pm »
If you wish to add support of "cp" file extension to CB know places that need work include.

  src/include/filefilters.h
  src/sdk/filefilters.cpp
  src/sdk/globals.cpp
  src/sdk/scripting/bindings/sc_consts.cpp
  src/src/associations.cpp

1. Add CP_EXT and CP_DOT_EXT  to filefilters.h and filefilters.cpp
2. Edit FileTypeOf in globals.cpp
3. Edit knownTypes in associations.cpp
4. Edit sc_consts.cpp
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline rajin100000

  • Single posting newcomer
  • *
  • Posts: 9
Re: How to set .cp extenstion as C++ source file for Codeblocks
« Reply #4 on: May 02, 2021, 12:03:55 am »
Where is this src directory? and before you say this thing, I tried to reinstall code blocks, but now the dialog doesn't appear with the four options. The four options were:-
1. No, leave everything as it is.
2. No, leave everything as it is but ask me again
3. Yes. associate code blocks to all c/c++ source file type
4. Yes, associate code blocks to all supported file type

Now, why is this not appearing?
And how to get the third or fourth option?  ??? ??? ??? ???

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: How to set .cp extenstion as C++ source file for Codeblocks
« Reply #5 on: May 02, 2021, 03:01:18 am »
So, you have no idea on how to build your own copy of Code::Blocks; then, you have no way to fix the problem.

Edit: Link to wiki that may help you to learn how to build Code::Blocks https://wiki.codeblocks.org/index.php/Installing_Code::Blocks_from_source_on_Windows

Tim S.
« Last Edit: May 02, 2021, 03:29:30 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org