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. :)
What extension has your filename ?
Yves
the extention of the file is .cpp
Can you post a minimal example?
#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.
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?
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)
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?
Yes, they use it to provide new mangled names for the changed types and they still provide the old mangled names for old code.
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.
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?
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?
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;