Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: fmc0501 on October 11, 2019, 03:06:54 am

Title: Code Completion and Hints aren't working
Post by: fmc0501 on October 11, 2019, 03:06:54 am
If I work on a GUI with wxWidgets, code completion and hints are good to go. But when I work on a console program, code completion and hints are MIA.

I've been using 17.12 and this was an issue. Earlier i downloaded the latest nightly build and that stuff's still gone when I work on a console program. Is there a setting somewhere to get these two things working in the console?


==============================
OS: Win X Pro
gcc version 8.1.0 (i686-posix-dwarf-rev0)
Title: Re: Code Completion and Hints aren't working
Post by: stahta01 on October 11, 2019, 12:27:33 pm
Is that a wxWidgets console program?
If yes, what wxWidgets version?

Note: I would only try to duplicate the issue and look for a possible cause; I am not likely to be able to fix anything more than a very minor problem.

Tim S.
Title: Re: Code Completion and Hints aren't working
Post by: fmc0501 on October 11, 2019, 04:43:35 pm
No. It isn't a wxWidgets console program. It's a standard C++ console application setup by Code::Blocks.  Its only include is <iostream>.

I wouldn't have thought anything about it, the lack of cc and hints, but I know I get them in a wxWidgets app. So I thought it was strange.  And I'm watching a video on C++ and the guy's working with the console (he's using C::B 16.01) and his code completion and hints work fine. So that led me to believe that I have something improperly configured.

UPDATE: I now have partial code completion. I get suggestions for keyword completion, but I still don't have...not sure what you would call it. But it goes like this.
Code
#include <iostream>

int main()
{
    std::string phrase = "Steak is good!";
    std:cout << phrase.

    return 0;
}

When I type phrase. I don't get options like find(), length(), or substr().  I can't even force selections to come up for me when I use Ctrl + Spacebar.  When I add them though, the code runs fine.  I'm pretty sure I have something set incorrectly...I just don't know what that would be.
Title: Re: Code Completion and Hints aren't working
Post by: stahta01 on October 11, 2019, 07:50:08 pm
It works for me. Edit2: Used C::B version 17.12 with MSys2 mingw64 gcc compiler.

Please check this setting
Settings -> Editor
left panel: CodeCompletion
Tab: C/C++ parser (Adv.)
checkbox needs to be checked: Include files w/o extensions

Edit: I had to close and reopen C::B after enabling the CC plugin (I normally do not use CC) to get it to work.

Tim S.
Title: Re: Code Completion and Hints aren't working
Post by: fmc0501 on October 11, 2019, 08:07:08 pm
I checked and it looked right.  See, if I type #inc a box comes up with selections, include being one of them. But when I try to add <cmath> to an #include, I get nothing, not even when I force it with Ctrl + SB. I guess I'll just have to live with it, but I wish I didn't have to.  The Code::Blocks IDE is too nice to not be able to have this functionality.
Title: Re: Code Completion and Hints aren't working
Post by: fmc0501 on October 11, 2019, 09:15:38 pm
I uninstalled Code::Blocks and all its files and reinstalled.  Same thing with a console program. But, on the bright side, code completion and hints work perfectly when using wxWidgets. So I'll live with this the way it is. Funny how all of this works for the guy in the vid using 16.01. Go figure

Anyway, thanks for your help, stahta01.
Title: Re: Code Completion and Hints aren't working
Post by: stahta01 on October 11, 2019, 11:35:13 pm
What compiler are you using? I would not be surprised if CC had issues with some compiler headers.

Edit: Like I said before my compiler is based on mingw64 and not on the mingw.org compiler line.
Edit2: I am using one parser per project; which I think is the default setting.
And, I have symbol table plugin disabled.

Tim S.
Title: Re: Code Completion and Hints aren't working
Post by: fmc0501 on October 12, 2019, 12:20:32 am
Here's a dump of my compiler:
Code
C:\Users\lands>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/MinGW/mingw32/bin/../libexec/gcc/i686-w64-mingw32/8.1.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../../../src/gcc-8.1.0/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-sjlj-exceptions --with-dwarf2 --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-pkgversion='i686-posix-dwarf-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/lib -L/c/mingw810/prerequisites/i686-zlib-static/lib -L/c/mingw810/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware'
Thread model: posix
gcc version 8.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project)

I upgraded to this to compile wxWidgets. The one that comes with CB 17.12 is old.

My settings are the same as yours for Code Completion.

I'm okay with how this is. For now. But I did just notice something peculiar with CB.

I set an int variable like this:
Code
int age{57};
and noticed that CB wldnt show it to me when I typed it out in another line, like it did with the string variables.

I had to set it
Code
int age = 57;
for age to be shown in the Code Completion. Is that a bug?
Title: Re: Code Completion and Hints aren't working
Post by: sodev on October 12, 2019, 03:43:55 am
Nope, it's a feature of CC to not understand C++11 ;D
Title: Re: Code Completion and Hints aren't working
Post by: fmc0501 on October 12, 2019, 03:50:57 am
Nope, it's a feature of CC to not understand C++11 ;D

No doubt a feature that needs to be rethought :D
Title: Re: Code Completion and Hints aren't working
Post by: oBFusCATed on October 12, 2019, 11:37:36 am
1. The cmath failure happens because the include finder code fails to find your include file. The reason for this should be debugged. For me on linux cmath is in the list of includes.
2. This is missing feature, patches welcome.