-3

If my code uses smart pointers, navigation and completion don't work with SourceInsight. For example with this simple example code:

class test {
public:
    void fun(){}
};

int main() {
    boost::scoped_ptr<test> a;
    a->fun();
    return 0;
}

When I click fun() in main , SourceInsight tells me "symbol not found".

Is there something I should do to fix that, or does SourceInsight have limitations?

sehe
  • 374,641
  • 47
  • 450
  • 633
waters
  • 11
  • 2
  • class test{ public: void fun(){} }; int main() { boost::scoped_ptr a; a.fun(); } – waters Nov 09 '17 at 14:44
  • Shouldn't this be `a->fun();`? – user0042 Nov 09 '17 at 14:46
  • Does this compile? What is the name of your class? Why click here? – Paul Floyd Nov 09 '17 at 14:56
  • that just a example,click a->func() source insight can jump to function void fun() of the class test.and I just edit in SI ,have not compile. – waters Nov 09 '17 at 15:06
  • I've reworded the question. I don't think it's broad. I don't think it's off-topic. **Voted to reopen**. Sadly, I never heard about SourceInsight and I'm not sure it will be popular. My gut says this is just a limitation of the tool, but perhaps someone else knows! – sehe Nov 10 '17 at 10:38
  • _For the code given_, the behavior seems entirely reasonable. There's no `#include` for boost, so how is SourceInsight to know that `boost::scoped_ptr` is a smart pointer? – MSalters Nov 10 '17 at 11:07
  • thanks sehe.it is popular in some areas. – waters Nov 10 '17 at 11:52
  • Erm. So, let's make that suggestion constructive: Did you include `boost/scoped_ptr.hpp` (and does SourceInsight know how to find the include)? – sehe Nov 12 '17 at 14:06

1 Answers1

2

So I've given this a try. Downloaded, virus-scanned, signed up for free trial, installed wine, run!

Now, I can make SourceInsight import the symbols from the Boost directories: enter image description here

I then enter the path to my Boost directory: Z:\home\sehe\custom\boost\ enter image description here

Processing takes a minute or two:

enter image description here

Seems ok:

enter image description here


Now if you import these symbols in your project:

enter image description here

You will find you can navigate to boost::scoped_ptr<> just fine (I double-clicked on the a in the declaration of a):

enter image description here

But it will not find references to fun:

enter image description here

Finds only the declaration:

enter image description here

Of course you can use simple string search, but that wasn't the point.

Here's the HTML export: https://s3.amazonaws.com/stackoverflow-sehe/f14b4ee2-9b4d-49cd-893d-cf69372dd586/HTML/test.cpp.html

enter image description here

Conclusion

It seems this is a limitation of SourceInsight, not due to misconfiguration.

sehe
  • 374,641
  • 47
  • 450
  • 633
  • I think so, as if it does not recognize "<>" as "()" in macros. Otherwise it can be configured – waters Nov 14 '17 at 14:43