Code::Blocks Forums

User forums => Help => Topic started by: doomed on February 12, 2011, 11:03:22 pm

Title: code completion for stand-alone source file
Post by: doomed on February 12, 2011, 11:03:22 pm
Hello, I learn C language and for this purpose I use Code::Blocks. I'd like to thank the developers for this cool peace of software. I have a little problem. When I create simple stand-alone C source file (it's not in any project) and I start to write the code (something like hello world  :lol:) code completion doesn't work. Actually it works but not in the way I would like. For example when I write "pri..." (I'd like to write printf), code completion offers me "private". So my question is: does the code completion work for stand-alone source files or does it work only if I create C consloe project? Thank you for your answers and sorry for my English (I'm from Czech Republic).
Title: Re: code completion for stand-alone source file
Post by: wolfcry on February 13, 2011, 02:41:04 am
Test it. Create a C project and try using auto-complete to see what choices it gives you. If it offers more, then you'll know that auto-complete is severly limited for stand-alone files. If it doesn't offer any more than what you were getting in the stand-alone file, then you know you'll need to start trouble shooting.

I say this, because it could be a variety of things. Your version of C::B, your OS etc. etc.
Title: Re: code completion for stand-alone source file
Post by: doomed on February 13, 2011, 11:07:17 am
Hi, thank you for your reply. Yes, it works fine for C console project. I only wondered If there is any possibility to make it work also for stand-alone source files? I'm runnig on Windows XP with SP3. In system PATH variable I've got MinGW bin and MSYS bin directory. Code::Block version is 10.05. Thanks.  :)
Title: Re: code completion for stand-alone source file
Post by: Jenna on February 13, 2011, 11:41:16 am
You should try a nightly build http://forums.codeblocks.org/index.php/board,20.0.html (http://forums.codeblocks.org/index.php/board,20.0.html).
There are many improvements to code-completion since the 10.05-release.
I just tested it on linux and it seems to work with a a single file.
Title: Re: code completion for stand-alone source file
Post by: doomed on February 13, 2011, 12:06:00 pm
Nice. It works! Only thing I had to do was to add string "stdio.h" to Settings > Editor > Code completion > C/C++ parser > Headers to parse up-front  :)  Thank you!
Title: Re: code completion for stand-alone source file
Post by: doomed on February 13, 2011, 11:39:35 pm
Sorry for mistake. I explored it more. It works only if I save new created source file and open it again. The file must also contains some include preprocessor directive (e.g. #include<stdio.h>) before reopening. Then it works even if add other includes (e.g. math, stdlib etc.)