News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

CodeBlocks Method Code completion

Started by gtg, April 05, 2017, 12:37:22 AM

Previous topic - Next topic

gtg

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

yvesdm3000

What extension has your filename ?

Yves
Clang based code completion for Code::Blocks:   [url="http://github.com/yvesdm3000/ClangLib"]http://github.com/yvesdm3000/ClangLib[/url]

gtg


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!]

gtg

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

oBFusCATed

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?
(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!]

ollydbg

#6
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:


If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

ollydbg

Some related report on other IDEs:
[QTCREATORBUG-16086] Refactoring fails for std::string on GCC 5 with C++11 ABI - Qt Bug Tracker

[QTCREATORBUG-15461] wrong autocompletion for std::string argument of a function with gcc5 - Qt Bug Tracker

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

EDIT: c++ - What are inline namespaces for? - Stack Overflow, it looks like my guess is right?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

oBFusCATed

Yes, they use it to provide new mangled names for the changed types and they still provide the old mangled names for old code.
(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!]

gtg

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.

NAbdulla

#10
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?

NAbdulla

Quote from: 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?

I am facing this issue with latest nightly build and gcc 8.1 mingw32. was it resolved in this version?

stanB

A quick but ugly fix to this problem is to have an extra namespace in your code ie.


using namespace std;
using namespace std::__cxx11;