Support std::shared_ptr<>
-
I use shared_ptr in qt creator. and it works fine.
but qt creator doesn't recognize the identifier in the editor.
so no highlights, no hints.
I guess its because it doesn't understand what is @QMAKE_CXXFLAGS += -std=c++11@ and thereby doesn't define @__GXX_EXPERIMENTAL_CXX0X__@ in its internal parser.PS I don't use QSharedPointer in this particular case because I need library w/o qt dependencies.
[Edit: Wrapped in @ tags to prevent incorrect formatting; mlong]
-
[quote author="Sergey I." date="1338983415"]qt creator doesn't recognize the identifier in the editor.
so no highlights, no hints.
I guess its because it doesn't understand what is @QMAKE_CXXFLAGS += -std=c++11@ and thereby doesn't define @__GXX_EXPERIMENTAL_CXX0X__@ in its internal parser.[/quote][quote author="Saul" date="1352166263"]The syntax highlighter finds std::shared_ptr if I add
@DEFINES += GXX_EXPERIMENTAL_CXX0X@
to my .pro file.[/quote]
This sounds like a bug or missing feature in Qt Creator. You can report it at https://bugreports.qt-project.org/secure/Dashboard.jspa , so that the Qt Creator team can fix it.
-
[quote author="JKSH" date="1352201290"]
This sounds like a bug or missing feature in Qt Creator. You can report it at https://bugreports.qt-project.org/secure/Dashboard.jspa , so that the Qt Creator team can fix it.[/quote]There appears to be an existing bug report on exactly this problem, created 05/Oct/11: https://bugreports.qt-project.org/browse/QTCREATORBUG-6239
It also notes the same workaround to allow auto-completion to work properly. The same problem exists in the latest eclipse IDE (juno), which is why I knew the solution.
-
Thanks for bringing that issue to my attention: I fixed that a while back and thus resolved the issue:-)
We do take compiler flags into account for a while now (incl. -std=Whatever) when querying the compiler for its defines. std::shared_ptr<int> is highlighted for me out of the box.
-
That's strange, because I am using the latest build, 2.6.0-rc, and no highlighting of std::shared_ptr was working, even though it compiled correctly i.e. I did have -std=c++11 set. I am using Ununtu 12.10, g++ 4.7.2.
...
Actually, just tested by creating a new project from template and added -std=c++11, all works, highlighting and accessing members through arrow access on the shared_ptr.
Never mind, my bad.
Not sure then why I had trouble when I first started my other projects (I am new to Qt Creator) -- perhaps needed to restart, or perhaps it takes a while to parse the full project to allow access to members?
Thanks.
-
Maybe it is the @DEFINES += GXX_EXPERIMENTAL_CXX0X@ workaround?
-
sorry to revive this old post, but I'm having the same problem with
std::shared_ptrthe syntax is not recognized by QtCreator, alltought the code compiles fine
and std::unique_ptr works fine.
what is weird is if I press f2 on unique_ptr, I can see the code for shared_ptr in the same class <memory> but still the syntax is not recognized,
it's kind of irritating because the indenting is all messed up whenever I used shared_ptrUsing QtCreator 5.1.2 with MSVC2010