views:

757

answers:

4

How to get Eclipse CDT to treat shared_ptr as T * for syntax completion?

I'm using windows in this instance. I have 1.39 in the "Program Files" folder. I am about to try 1.37.

I am using the Galileo release of Eclipse. Also, I am only editing and browsing the source in Eclipse and building in VC++ Express. (but that is another story)

+3  A: 

What version of boost are you using?

According to this thread:

Turns out there is something about Boost 1.39 that the CDT indexer does not like.
If I allow CDT to index boost 1.36 then auto-complete works for typedef'ed elements like below.
If I allow it to index only 1.39 then the same auto-completion does not work.

(Happens with CDT5 or 6)

VonC
+2  A: 

Eclipse CDT indexing of boost libraries starts struggling with version 1.37 (or even 1.36, couldn't' verify that) already.

My workaround to benefit from code completion while using an up-to-date boost version (1.39) is the following one:

  • I have got two boost versions (1.35 and 1.39) on my computer.
  • In the Debug Build Configuration (Settings/Directories) I set the include path to the old boost version.
  • In the Release Build Configuration I set the include path to the actual boost library.
  • I set the Indexer Option "Build Configuration for the Indexer" to "Use fixed build configuration" > Debug

The indexer uses now the old library for indexing and code completion but the release version will still be compiled with the recent boost version. At least this worked for me. Please verify this for your build configuration, if you're suffering the same problem!!

Maus
+1  A: 

I just tried it out in Eclipse 3.6 M5 (a Helios milestone build) with the corresponding version of CDT 7.0 and it was able to auto complete the boost::shared_ptr's that it previously failed on in Eclipse 3.5 with CDT 6. I am using Boost 1.40, so they must have fixed whatever problem the template indexer had.

You can try out the new build by going to http://www.eclipse.org/downloads/ , selecting "Development Builds" and then selecting "Eclipse for C/C++" as usual.

Eric Perko
A: 

This has been a source of frustration for me for a long time, but after recently upgrading to Galileo and CDT 6, it is now working!

Boost: 1.39
CDT: 6.0.2.201002161416

Hope this helps.

Droj