Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: dashashi on April 22, 2012, 01:16:50 pm

Title: When open source file directly the auto completion doesn't work
Post by: dashashi on April 22, 2012, 01:16:50 pm
First sorry for my poor english.
I usually write code for some microcontrollers such as PIC and stm32, and the editor of their IDE is head to use, but I have to download the program and debug under their IDE. So I want to use codeblocks just as a editor nor a IDE.
I added the path of header file in the way mentioned http://forums.codeblocks.org/index.php?topic=10933.0 and if I launch CodeBlocks first and then open the source file from CodeBlocks, the auto completion works fine. While if I open source file directlly in the explorer(I set the CodeBlocks as default editor of cpp file), the auto completion just doesn't work.
Is it a bug or something wrong in my setting?
Title: Re: When open source file directly the auto completion doesn't work
Post by: MortenMacFly on April 22, 2012, 01:22:01 pm
Is it a bug or something wrong in my setting?
If you just open a file it is w/o a project. Thus, C::B cannot know the configuration for that file, e.g. what compiler it uses, what include folders are needed and so on. Therefore CC is disabled, or at least reduced to a minimum.

You need a properly setup project for this to work.
Title: Re: When open source file directly the auto completion doesn't work
Post by: dashashi on April 22, 2012, 01:26:09 pm
But if I open the file (with out project) in C::B, It just works fine.
And I found after open the file directly, Press F9 to compile, then modify the file a little, save it, the code completion works just fine again- -|||
Title: Re: When open source file directly the auto completion doesn't work
Post by: dashashi on April 22, 2012, 01:37:29 pm
When there's no project, C::B use GCC as default compiler and why can't it use GCC's global setting of header files to help me auto complete- -||
Title: Re: When open source file directly the auto completion doesn't work
Post by: MortenMacFly on April 22, 2012, 02:59:14 pm
When there's no project, C::B use GCC as default compiler and why can't it use GCC's global setting of header files to help me auto complete- -||
Well it does (as you had just pointed out), but never to an extend as it is possible with a project. That's what I meant with:
Therefore CC is disabled, or at least reduced to a minimum.
Title: Re: When open source file directly the auto completion doesn't work
Post by: Jenna on April 22, 2012, 03:02:27 pm
When there's no project, C::B use GCC as default compiler [...]

That's not absolutely true, it should use the compiler set as default compiler, it's gcc as default, but can be changed by the user.
Title: Re: When open source file directly the auto completion doesn't work
Post by: dashashi on April 23, 2012, 02:53:50 am
I mean C::B could use the default setting of compiler(including search path) to auto complete.