Author Topic: C only code completion?  (Read 3877 times)

Offline Sindisil

  • Multiple posting newcomer
  • *
  • Posts: 10
C only code completion?
« 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:

  • 1. Does the code completion not distinguish between C and C++?
    I'm editing a .c file, and I'm getting "private" as a completion for "pri".
  • 2. Shouldn't I be getting completion for stdlib functions like printf? I've checked the follow includes items for both local and global includes.

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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6895
    • My Best Post
Re: C only code completion?
« Reply #1 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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Sindisil

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: C only code completion?
« Reply #2 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.

Offline Sindisil

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: C only code completion?
« Reply #3 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12596
    • Travis build status
Re: C only code completion?
« Reply #4 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).
« Last Edit: December 07, 2010, 08:40:57 am by oBFusCATed »
(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 Sindisil

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: C only code completion?
« Reply #5 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".

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12596
    • Travis build status
Re: C only code completion?
« Reply #6 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) :)
(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 Sindisil

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: C only code completion?
« Reply #7 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!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12596
    • Travis build status
Re: C only code completion?
« Reply #8 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
(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 Sindisil

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: C only code completion?
« Reply #9 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.