Author Topic: syntax highlighting in C/C++  (Read 14126 times)

Offline pomelo

  • Single posting newcomer
  • *
  • Posts: 4
syntax highlighting in C/C++
« on: August 30, 2011, 10:51:46 am »
hi,

I want to know if there is any way to set special colors to functions, macro definitions, and typedefed types in C/C++.

thanks in advance.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9702
Re: syntax highlighting in C/C++
« Reply #1 on: August 31, 2011, 08:43:06 am »
I want to know if there is any way to set special colors to functions, macro definitions, and typedefed types in C/C++.
Inspect the lexer settings for the language of your choice in the editor options.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline pomelo

  • Single posting newcomer
  • *
  • Posts: 4
Re: syntax highlighting in C/C++
« Reply #2 on: August 31, 2011, 09:38:09 am »
Inspect the lexer settings for the language of your choice in the editor options.
In Syntax Highlighting settings' panel there is a predefined highlighting mode for C/C++, but the predefined mode does not handle colors for functions, macro definitions... and I failed to find the way to add them to the predefined list. What is more, I did add a new color theme, with different name besides default, but it seems still impossible to modify predefined lexer settings.
Any detailed instructions? Thanks a lot.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: syntax highlighting in C/C++
« Reply #3 on: August 31, 2011, 09:58:04 am »
What you want is semantic highlighting (hope the term is correct), which C::B doesn't support.

Something like this: http://zwabel.wordpress.com/2009/01/08/c-ide-evolution-from-syntax-highlighting-to-semantic-highlighting/
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline pomelo

  • Single posting newcomer
  • *
  • Posts: 4
Re: syntax highlighting in C/C++
« Reply #4 on: September 01, 2011, 11:50:56 am »
Thanks oBFusCATed! So there is no way to use semantic highlighting in CB?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: syntax highlighting in C/C++
« Reply #5 on: September 01, 2011, 12:34:15 pm »
There is one way, you can implement it yourself :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline axmz

  • Single posting newcomer
  • *
  • Posts: 2
Re: syntax highlighting in C/C++
« Reply #6 on: October 12, 2011, 04:24:47 pm »
hi
I've just installed code::blocks and wanted to write the source code in c language but when I started to type the code I instantly realized that the syntax highlighting wasn't working. I checked the the syntax highlighting menu in the editor settings and there are no predefined modes of any kind. have I missed to install some plug-in or why isn't it working?

Offline Freem

  • Almost regular
  • **
  • Posts: 219
Re: syntax highlighting in C/C++
« Reply #7 on: October 12, 2011, 04:31:10 pm »
What is your OS?
Which version of C::B are you using?
How did you install it? (compilation of sources, installation from official installer?)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7668
    • My Best Post
Re: syntax highlighting in C/C++
« Reply #8 on: October 12, 2011, 04:57:00 pm »
@axmz:

What is the file extension; I believe Code::Blocks uses the file extension to determine Language.

Tim S.
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 axmz

  • Single posting newcomer
  • *
  • Posts: 2
Re: syntax highlighting in C/C++
« Reply #9 on: October 14, 2011, 11:57:35 am »
OS: WinXP
C::B version: 10.05
I installed the official version I downloaded from this official site but I've kinda rushed the installation, so it's possible that I unintentionally overlooked some settings along the way...
File extension is *.c source file (if that's what your question regarded to)