Author Topic: Find declaration and Find implementation  (Read 8425 times)

Offline electrolot

  • Multiple posting newcomer
  • *
  • Posts: 18
Find declaration and Find implementation
« on: April 19, 2009, 11:18:17 am »
I have included some files from directory outside project directory. I add in "Search directory" correct directory of included files. I do it in properites of project and in Settings of C::B.
Find declaration (implementation) does not work in this case.
Could you give some advise?

glukensoft

  • Guest
Re: Find declaration and Find implementation
« Reply #1 on: May 15, 2009, 09:50:28 am »
Have the same problem with C::B  8.02 at Ubuntu (binary package from repos).
I was unable to find declaration of 'sleep' function explicitly declared in 'unistd.h' (always obtaining 'Not found:' message) in this simple piece of code:

#include <iostream>
#include <unistd.h>
using namespace std;

int main()
{
    sleep(1);
    cout << "Hello world!" << endl;
    return 0;
}

though I added '/usr/include' and '/usr/include/c++/4.3.3' in global list of search directories, as wel as in the project options too.  Maybe there are some external dependencies (ctags ?) need to be installed, or patches need to be applied on C::B source code, or anything else?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Find declaration and Find implementation
« Reply #2 on: May 15, 2009, 10:33:12 am »
No, ctags is not need.

See the wikipage here:

http://wiki.codeblocks.org/index.php?title=Code_Completion_Design#Code-Completion_debug_tool_dialog

I test your code in MinGW, there is no function named "sleep", there is only "usleep" in that header file.

see the snapshot below:





[attachment deleted by admin]
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Find declaration and Find implementation
« Reply #3 on: May 15, 2009, 10:35:38 am »
to electrolot:

You can add the search path in "build options ->search directory->compilers", It works quite well in my system.

Could give a simple test case?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

glukensoft

  • Guest
Re: Find declaration and Find implementation
« Reply #4 on: May 15, 2009, 01:47:10 pm »
Thank you for reply,

I went on with experiments with source code examples and have find out that 'Find declaration' doesn't work for my *cpp and *h files with standart library functions (I've tried with '*sleep' and 'pthread_*' functions and always got 'Not found' error message); but works perfectly with my own classes and functions, as well as finding standart C functions' and types' declarations in standart *h files placed in /usr/include.

So i am not really sure if 'Find declaration's behaviour is a bug or a feature :)