News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

How to set .cp extenstion as C++ source file for Codeblocks

Started by rajin100000, April 30, 2021, 06:51:44 PM

Previous topic - Next topic

rajin100000

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?

BlueHazzard

cp is no standard cpp extension...
but if you are on windows you can simply right cklick "open with" set codeblocks as default

rajin100000

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.

stahta01

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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

rajin100000

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?  ??? ??? ??? ???

stahta01

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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]