Code::Blocks Forums

User forums => Help => Topic started by: gtg on April 05, 2017, 12:37:22 am

Title: CodeBlocks Method Code completion
Post by: gtg on April 05, 2017, 12:37:22 am
Hello, I have the following problem. When i try to use some method from the "string" variable the intellisense/SmartSence is not showing the available methods. The code is compiled fine, but it's really frustrating to not have helping intellisense. The interesting thing is that if i disable SmartSence, the available methods are showing, plus alot other option that are not useful. I'm using Linux, ubuntu 16.04, Codeblocks version 16.01 - wx2.8.12 64bit, gnu gcc compiler. Some help will be appreciated.  :)
Title: Re: CodeBlocks Method Code completion
Post by: yvesdm3000 on April 05, 2017, 07:13:20 am
What extension has your filename ?

Yves
Title: Re: CodeBlocks Method Code completion
Post by: gtg on April 05, 2017, 09:46:27 am
the extention of the file is .cpp
Title: Re: CodeBlocks Method Code completion
Post by: oBFusCATed on April 05, 2017, 09:52:09 am
Can you post a minimal example?
Title: Re: CodeBlocks Method Code completion
Post by: gtg on April 05, 2017, 01:11:30 pm
Code
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string str = "String";
    int strSize = str.size();
    cout << "String Size is " << strSize << endl;
    return 0;
}

Here is the code. It is compiled and works properly (it outputs the size of the string). The problem is that after the str (str is the string variable/object) when I write "." (the dot) intellisense/SmartSence is no't showing the possible methods. Btw thx for the attention. guys.
Title: Re: CodeBlocks Method Code completion
Post by: oBFusCATed on April 05, 2017, 08:45:10 pm
What compiler version are you using?
I guess is newer than 5.x and so you're probably using the new c++abi, which uses c++11 features which our parser doesn't support.

I can reproduce the problem when I switch my compiler to GCC 6.3.0.

@ollydbg: Can you try to reproduce this problem?
Title: Re: CodeBlocks Method Code completion
Post by: ollydbg on April 06, 2017, 02:34:22 am
OK, I see the code suggestion of "str." under GCC 6.3 does not work, because the "basic_string" is now under a namespace inside namespace std.

Question: Where dose the actual "std::string" type actually defined? It should to connected to "std::__cxx11::basic_string<char>" or similar things.

See the image shot below:
(http://i683.photobucket.com/albums/vv194/ollydbg_cb/2017-04-06%2008%2030%2041_zpsacfeutyq.png)

Title: Re: CodeBlocks Method Code completion
Post by: ollydbg on April 06, 2017, 03:16:10 am
Some related report on other IDEs:
[QTCREATORBUG-16086] Refactoring fails for std::string on GCC 5 with C++11 ABI - Qt Bug Tracker (https://bugreports.qt.io/browse/QTCREATORBUG-16086)

[QTCREATORBUG-15461] wrong autocompletion for std::string argument of a function with gcc5 - Qt Bug Tracker (https://bugreports.qt.io/browse/QTCREATORBUG-15461)

It looks like QTcreator are moving to libclang, so they won't solve this issue in their current build-in parsers.

And some article about this "inline namespace", in-fact, I don't know what does the "inline namespace" means, does it means

std::string == std::__cxx11::string?

See this document: GCC compatibility: inline namespaces and ABI tags - Christian Aichinger's thoughts (https://greek0.net/blog/2016/10/29/gcc_compatibility/)

EDIT: c++ - What are inline namespaces for? - Stack Overflow (http://stackoverflow.com/questions/11016220/what-are-inline-namespaces-for), it looks like my guess is right?
Title: Re: CodeBlocks Method Code completion
Post by: oBFusCATed on April 06, 2017, 08:25:58 am
Yes, they use it to provide new mangled names for the changed types and they still provide the old mangled names for old code.
Title: Re: CodeBlocks Method Code completion
Post by: gtg on April 06, 2017, 09:02:21 pm
Sorry for the late comment. Wow thanks for help and the attention. How must i proceed change (I'm newbie into the c++/oop programing) the gnu gcc compiler version / c++ version , or there I must do some other changes. Thanks again.
Title: Re: CodeBlocks Method Code completion
Post by: NAbdulla on July 07, 2019, 07:13:16 pm
Is there any nightly build which solves the issue ie: which nightly build works with mingw-w64 6.x.x or later versions and support string object method completion?
Title: Re: CodeBlocks Method Code completion
Post by: NAbdulla on February 27, 2020, 05:13:12 pm
What compiler version are you using?
I guess is newer than 5.x and so you're probably using the new c++abi, which uses c++11 features which our parser doesn't support.

I can reproduce the problem when I switch my compiler to GCC 6.3.0.

@ollydbg: Can you try to reproduce this problem?

I am facing this issue with latest nightly build and gcc 8.1 mingw32. was it resolved in this version?
Title: Re: CodeBlocks Method Code completion
Post by: stanB on April 03, 2022, 06:37:44 pm
A quick but ugly fix to this problem is to have an extra namespace in your code ie.

Code
using namespace std;
using namespace std::__cxx11;