Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Sindisil on December 06, 2010, 09:49:22 pm

Title: C only code completion?
Post by: Sindisil on December 06, 2010, 09:49:22 pm
In search of an IDE that will give me decent support for both C99 and C++0x, I'm giving C::B nightly a shot (SVN 6863, it says).

Whilst it looks pretty darn nice so far, I have a couple questions on the code completion:


I searched the forums, and found refs to the stdlib completion in some threads on the code completion rewrite branch, but it appeared that branch was merged to trunk in October, and 6863 is from Nov. 27.
Title: Re: C only code completion?
Post by: stahta01 on December 06, 2010, 09:54:51 pm
Sounds like you are looking for Pelles C; you might wish to try it.
I have no idea if the Pelles IDE has the items you are looking for; but, the compiler sounds like a possible match. This assumes the GCC does not match your Compiler requirements.

Tim S.
Title: Re: C only code completion?
Post by: Sindisil on December 06, 2010, 10:10:47 pm
Compiler isn't an issue, as gcc (and mingw, by extension) near the best C99 and C++0x support around.

It's IDE support I'm looking for. I can work just fine in vim, and do in my day job, since most dev is done via ssh to remote hosts. However, I prefer certain niceties of IDEs (primarily language aware search and code complete, plus debugger integration) for my personal projects.

I own VS2k8, and it's OK for older C++, but I've heard mixed feedback on 2k10, and the Microsoft compiler's support for C++0x is less complete that gcc's. And don't even get me started on VS and standard C.

Thanks anyway, though. Perhaps I'll check out Pelles anyway, just in case.
Title: Re: C only code completion?
Post by: Sindisil on December 06, 2010, 10:14:01 pm
OK, I found a workaround for the system headers issue, though I still don't see why it doesn't work out of the box.

If I add the system include directory to the project specific C/C++ parser options, I get completion as expected.

No clue what downsides there might be, though.
Title: Re: C only code completion?
Post by: oBFusCATed on December 07, 2010, 08:37:11 am
This sounds more like a bug?
Does completing printf work for c++ projects?
It works for me.

p.s. Works for C project, too, I've just created a simple console c project and it works out of the box (I'm using r6570).
Title: Re: C only code completion?
Post by: Sindisil on December 07, 2010, 05:05:18 pm
I'll try a few permutations when I get a chance.

I did just create a new console project, and selected "C" in the wizard, and both completion issues still exist (i.e. I'm seeing "private" as the completion for "pri..." and no "printf"). Again, I'm running 6863.

Near as I can tell, the only difference between a "C project" and a "C++ project" is that the initial source file is a ".c" file, rather than ".cpp".
Title: Re: C only code completion?
Post by: oBFusCATed on December 07, 2010, 05:26:32 pm
There is another difference: the C compiler is used, not the C++ compiler (gcc instead of g++)

Probably the private/protected bug is easy to fix, because this keywords are hard-coded (parsing is related) :)
Title: Re: C only code completion?
Post by: Sindisil on December 07, 2010, 09:31:58 pm
There is another difference: the C compiler is used, not the C++ compiler (gcc instead of g++)

Near as I can tell, that's per file type.

I see in the project file that, for a C project, it specifies "CC" for compiler and for a CPP project, it doesn't specify a compiler. I see no place to change the "type" once a project is created, though.

Also, when I add a .c file  to a "C++ project", it gets the "CC" attribute added.

Oddly, when I add a .cpp file to a "C project", it doesn't.

I'll have to monkey with it a bit when I get more time. IMHO, the current behavior is buggy, but I've just started trying to use C::B, so it's just as likely that I simply don't understand how things are supposed to work.

Quote
Probably the private/protected bug is easy to fix, because this keywords are hard-coded (parsing is related) :)

I'll have to dig in to the source and see if it's worth it for me to come up with fixes for some of these things, or if I should try to get something resembling my Linux dev situation working on Windows. msys works, but I prefer to work natively on each platform, if I can.

I certainly don't want to go back to Visual Studio unless I can't find a better option. The price (in time and hassle, not to mention money) is way to high, though the useability is, if not perfect, at least reasonable.

C::B seems well worth investing some time in, and I'm certainly thankful for what's been done so far!
Title: Re: C only code completion?
Post by: oBFusCATed on December 07, 2010, 09:48:44 pm
I see in the project file that, for a C project, it specifies "CC" for compiler and for a CPP project, it doesn't specify a compiler. I see no place to change the "type" once a project is created, though.
You can: right click on the file in project manager -> properties -> advanced
Title: Re: C only code completion?
Post by: Sindisil on December 07, 2010, 11:29:32 pm
Cool, thanks.

That does, however, indicate that there are not C and C++ Projects, but C and C++ *files, no? Which is actually just fine by me.