Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: erezz on December 29, 2011, 12:54:42 pm

Title: Cross reference?
Post by: erezz on December 29, 2011, 12:54:42 pm
Hi,

I'm new to codeblocks and couldn't find anything about cross reference. Here's what I would like to do:

If I have code that looks like this:

Code
void f1()
{
}

void f2()
{
    f1();
}

int main()
{
    f1();
}

I want to be able to view all calls to f1(). Is it possible? Of course, I can just use the search tool, but I prefer to be able to right-click a symbol and find where it is used.

Thanks,
Erez
Title: Re: Cross reference?
Post by: MortenMacFly on December 29, 2011, 01:20:06 pm
I want to be able to view all calls to f1().
Yes, if you are using the CScope plugin. As you didn't mention anything about your configuration I cant help more.
Title: Re: Cross reference?
Post by: erezz on December 29, 2011, 01:34:44 pm
I'm running v10.05 on ubuntu. How do I install this plugin? Do I need to compile it?

Thanks,
Erez
Title: Re: Cross reference?
Post by: oBFusCATed on December 29, 2011, 01:44:20 pm
Do you have the contrib plugins installed? You need to install codeblocks-contrib package.

But, I'm not sure if the cscope plugin is available in 10.05.
If it is not available you'll have to use a nightly build from Jens' repo @ apt.jenslody.de (http://apt.jenslody.de)
Title: Re: Cross reference?
Post by: erezz on December 29, 2011, 01:53:17 pm
I've just installed codeblocks-contrib. How can I check if cscope is available for v10.05? In general, where can I look for plugins for v10.05?

Thanks,
Erez
Title: Re: Cross reference?
Post by: Jenna on December 29, 2011, 01:57:00 pm
You also need the cscop package provided by your distro, to make the plugin work.

I've just installed codeblocks-contrib. How can I check if cscope is available for v10.05? In general, where can I look for plugins for v10.05?

"Plugins -> Manage plugins" lists all available plugins and their state.
Title: Re: Cross reference?
Post by: erezz on December 29, 2011, 02:36:50 pm
I installed cscope (supplied by ubuntu), but I don't see it in the list in "Plugins -> Manage plugins". Did I miss anything?

BTW - the ubuntu cscope package contains the following files:

/.
/usr
/usr/bin
/usr/bin/cscope
/usr/bin/ocs
/usr/bin/cscope-indexer
/usr/share
/usr/share/doc
/usr/share/doc/cscope
/usr/share/doc/cscope/contrib
/usr/share/doc/cscope/contrib/README
/usr/share/doc/cscope/contrib/webcscope
/usr/share/doc/cscope/contrib/webcscope/cscope.gz
/usr/share/doc/cscope/contrib/webcscope/icons
/usr/share/doc/cscope/contrib/webcscope/icons/back.gif
/usr/share/doc/cscope/contrib/webcscope/icons/bomb.gif
/usr/share/doc/cscope/contrib/webcscope/icons/c.gif
/usr/share/doc/cscope/contrib/webcscope/icons/down.gif
/usr/share/doc/cscope/contrib/webcscope/icons/folder.gif
/usr/share/doc/cscope/contrib/webcscope/icons/folder.open.gif
/usr/share/doc/cscope/contrib/webcscope/icons/left.gif
/usr/share/doc/cscope/contrib/webcscope/icons/up.gif
/usr/share/doc/cscope/contrib/webcscope/icons/world2.gif
/usr/share/doc/cscope/contrib/webcscope/INSTALL
/usr/share/doc/cscope/contrib/webcscope/TODO
/usr/share/doc/cscope/contrib/webcscope/cgi-lib.pl.gz
/usr/share/doc/cscope/contrib/webcscope/hilite.c.gz
/usr/share/doc/cscope/AUTHORS
/usr/share/doc/cscope/README
/usr/share/doc/cscope/TODO
/usr/share/doc/cscope/copyright
/usr/share/doc/cscope/NEWS.gz
/usr/share/doc/cscope/changelog.Debian.gz
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/cscope.1.gz
/usr/share/man/man1/ocs.1.gz
/usr/share/man/man1/cscope-indexer.1.gz

Thanks,
Erez
Title: Re: Cross reference?
Post by: oBFusCATed on December 29, 2011, 02:45:54 pm
Then you need a nightly build of codeblocks...
Title: Re: Cross reference?
Post by: Jenna on December 29, 2011, 03:38:22 pm
You can install a nightly-build from my server: http://apt.jenslody.de (http://apt.jenslody.de).
See the note for Ubuntu-users on my server !

EDIT:
You might have to remove all C::B packages before you can update from 10.05 release.
Don't be afraid, all (user-)settings will remain.
Title: Re: Cross reference?
Post by: erezz on December 29, 2011, 04:12:14 pm
I followed your instructions and added to /etc/apt/sources.list the following lines:

Code
deb http://apt.jenslody.de/ any main
deb-src http://apt.jenslody.de/ any main
deb http://apt.wxwidgets.org/ lenny-wx main

I got this when trying to install:

Code
The following packages have unmet dependencies:
codeblocks: Depends: libcodeblocks0 (= 10.05svn7639-1) but it is not going to be installed
Depends: libwxbase2.8-0 (>= 2.8.12.1) but 2.8.11.0-0ubuntu8.1 is to be installed
Depends: libwxgtk2.8-0 (>= 2.8.12.1) but 2.8.11.0-0ubuntu8.1 is to be installed
codeblocks-additional: Depends: libcodeblocks0 but it is not going to be installed
Depends: libwxsmithlib0 (= 10.05svn7639-1) but it is not going to be installed
codeblocks-contrib: Depends: libcodeblocks0 but it is not going to be installed
Depends: libwxbase2.8-0 (>= 2.8.12.1) but 2.8.11.0-0ubuntu8.1 is to be installed
Depends: libwxgtk2.8-0 (>= 2.8.12.1) but 2.8.11.0-0ubuntu8.1 is to be installed
Depends: libwxsmithlib0 (= 10.05svn7639-1) but it is not going to be installed
Title: Re: Cross reference?
Post by: Jenna on December 29, 2011, 10:29:57 pm
Are the packages from apt.wxwidgtes.org visible in your package-manager ?
If not, did you update the lists after adding apt.wxwidgets.org ?

I just tested it on ubuntu 10.04 (under qemu-kvm) and it works as expected.

Did you import the wxwidgets key as described on my site ?
Normally it should warn about untrusted key, but work anyway,
nevertheless it might be wort a try:

Code
wget -q http://apt.wxwidgets.org/key.asc -O-  | sudo apt-key add -

Title: Re: Cross reference?
Post by: erezz on January 01, 2012, 08:19:14 am
Yes, those packages are available in the list, and yes, I did run the "wget -q http://apt.wxwidgets.org/key.asc -O-  | sudo apt-key add -" command.

I manually removed the libwxbase package and then I installed the package from apt.wxwidgets.org (via apt-get). Now, I have v2.8.12.0-0, but it looks like I need v2.8.12.1. Here's the new error message:

Code
root@erez-lx:~/t# apt-get install codeblocks
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 codeblocks : Depends: libcodeblocks0 (= 10.05svn7639-1) but it is not going to be installed
              Depends: libwxbase2.8-0 (>= 2.8.12.1) but 2.8.12.0-0 is to be installed
              Depends: libwxgtk2.8-0 (>= 2.8.12.1) but it is not going to be installed
E: Broken packages
Title: Re: Cross reference?
Post by: Jenna on January 01, 2012, 11:00:15 am
I really don't know what happens there.
I tested it on Ubuntu 11.10 and it works flawlessly.

The lenny-wx repo of apt-wxwidgets.org has 2.8.12.1 in it and if I chose codeblocks and codeblocks-contrib synaptic choses it automagically for me.

Maybe you should try to install it via synaptic (and check whether the appropriate version is available).
Title: Re: Cross reference?
Post by: erezz on January 01, 2012, 01:16:53 pm
I think that I understand the problem: if you look at http://apt.wxwidgets.org/dists/natty-wx/main/binary-i386/, you will not find v2.8.12.1. If you look at http://apt.wxwidgets.org/dists/lenny-wx/main/binary-i386/, you will find it (http://apt.wxwidgets.org/dists/lenny-wx/main/binary-i386/libwxbase2.8-0_2.8.12.1-0_i386.deb).

So, I changed the line in /etc/apt/sources.list from "natty" to "lenny" (although I'm running ubuntu 11.04 Natty Narwhal) and was able to install codeblocks. For some reason, they don't like ubuntu 11.04??

Anyway, thanks a lot for your help.

Erez
Title: Re: Cross reference?
Post by: Jenna on January 01, 2012, 03:07:10 pm
If you would have read the note for ubuntu users on my page (http://apt.jenslody.de/) carefully, you would have seen, that I asked you to use the lenny-wx repo for ubuntu.
By the way, the maverick repo contains 2.8.12.1, too, as far as I know.