2

Codeblocks cannot find definitions or declarations of some functions in my project.

Question: Is there a way to force a re-scan of the source tree?

I believe that all of the relevant files are included into the project. (Just checked: it cannot find by name a struct declared in an opened file.)

2 Answers 2

2

First, let me give a couple of ways to help C::B find your declarations/definitions.

Although somewhat obvious, you should make sure the function is in a file that is either: 1) part of the project itself (i.e. it should be shown in the projects->workspace window). If you intended it to be part of the project but it isn't there, then go to project->add files and add the file. 2) If you don't want/need the file to be part of the project but you still want to access the declarations/definitions, you need to let the project manager know where to find the file. You can do this in project->build options and set the search directories. Be careful when setting the search directories...you can set it for the whole project or build target (debug or executable).

Note: one common problem occurs when you have multiple projects open in C::B. Even though all your projects are "open", there is only one that is "activated". So, just because you have a file open, it doesn't mean the file is part of the activated project. You can do search-->open files" which will find code in a file if it's open but not in the current active project.

The only way to "re-scan", is to rebuild your project after making changes in the source code or project settings. You may have to restart C::B. If you still can't find the declaration/definition after doing the above, I would suggest you make a sample program and see if it will find the declaration/definition. If it does, then you can check the settings between your project and the sample project. In the worst case, you can copy your code from your project to the sample project. If that doesn't work, you can reinstall C::B and try again. Not fun but sometimes it works.

Sign up to request clarification or add additional context in comments.

Comments

0

You can try, rebuilding the project, but make sure at least one other file includes the header for the structure or make sure the header and source file are included in the project.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.