News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

code completion for stand-alone source file

Started by doomed, February 12, 2011, 11:03:22 PM

Previous topic - Next topic

doomed

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).

wolfcry

#1
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.
C::B Version = 10.5
OS = Microsquish XP

doomed

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.  :)

Jenna

You should try a nightly build http://forums.next.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.

doomed

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!

doomed

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.)