Author Topic: Any easy way to add many search directory locations?  (Read 5591 times)

Offline nebulism

  • Single posting newcomer
  • *
  • Posts: 7
Any easy way to add many search directory locations?
« on: December 09, 2008, 04:28:35 pm »
Hello again everyone,

I decided to scrap developing my own makefile and I am just sticking with C::B's automatic one. 

I am getting the build options -> search directories -> compiler -> add (directory location for header) to work.  My question is, there are many directories (over 40) that I would need to add to get my program to compile.  Is there any quick way of adding many directories?

For instance, say I have header 1-40.hh.  They lie in this structure: somerootfolder->folder1, folder2, folder3, etc.  This is how Geant4 structures all of its classes/headers.

Thank you as always,
JP

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Any easy way to add many search directory locations?
« Reply #1 on: December 15, 2008, 09:13:47 am »
I don't think there is a fast way to add so many paths of include files. You can just add one by one manually.
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 dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Any easy way to add many search directory locations?
« Reply #2 on: December 15, 2008, 02:55:57 pm »
my ShellExtensions plugin has a file browser that lets you multi-select files, right click and add them all to the currently active project. follow the link to the project page in my sig.

muonics

  • Guest
Re: Any easy way to add many search directory locations?
« Reply #3 on: May 20, 2009, 05:45:11 pm »
Hi - I love that your shellextensions plugin allows for multiple file selection, however I don't think it is the answer to the original posters issue which is to have folders automatically added to the Search Directories under Build Options... when you add files to your project.

Otherwise you have only added the files, but codeblocks complains that it can't find the file because it doesn't know to look in the folder that the file was added from.

ie:

if you have a file structure like

myCodeblocksProject.cbp
src/
 main.cpp
 folderA/
    headerA.h
 folderB/
    headerB.h

To add headerA.h in src/folderA/ to your project you have to first add the file with add files.... then you have to go to Build Options.... and add src/folderA/ to the Search Directories... panel.

It would save soooo much time if when you do add files....... and select headerA.h there was an option to automatically add src/folderA/ to the project Search Directories. Otherwise for projects with large amounts of source code it can sometimes take 30mins to an hour to manually add all the Search Directories. It seems like it would make sense to have the Add files recursively... option be able to add the relevant Search Directories as well.

ps: I don't expect your ShellExtensions plugin to do this (though it would be awesome) but this is sort of hoping that it is added to the IDE itself (along with multiple file selection).
 

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Any easy way to add many search directory locations?
« Reply #4 on: June 16, 2009, 10:33:21 pm »
this is quite an old post you are revisiting. you are right that I misread the OP.

you can also achieve what you need with a script that simply echoes the needed files to stdout. then use a backtick to call the script which will substitue the output of the script into the compiler command line.

This is how many of the code::blocks templates work on linux: e.g. for gtk add something like `pkg-config gtk+ --cflags` to the compiler options

Offline johu

  • Single posting newcomer
  • *
  • Posts: 8
Re: Any easy way to add many search directory locations?
« Reply #5 on: August 30, 2009, 01:19:58 pm »
Hi, I'd like to support the "request for a feature" of the OP. I'm come from SNiFF+ IDE (which is dead) which has features to generate the include directives for compiling automatically and also the library list for linking in an executable project. The generation of this clauses is based on the project dependencies (So I don't understand why are dependencies of projects are properties of the workspace and not of the projects themselves). As an impression what I have in mind: I write down an declaration "SomeClass m_xyz;". If SomeClass is somewhere declared in workspace, CB can navigate me to the declaration of this class in an other project. What about entries in the context menu  (after "Find implementation of: 'SomeClass') with content "Add a dependency to project containing "'SomeClass'", "Add the search directory to compiler options", "Add a library entry to link option list"? I think, opening the context menu, CB has all information in the hand to do this. The plugins Library Finder and Header Fixup are doing similar tasks but for stuff out off CB but not for organizing the CB workspace  itself. At the moment I'm not able to implement such things myself because I have to prepare the migration from SNiFF+ to CB in our team. That means the conversion of hundred of projects (!) for which I'm writing an converter which produces *.cbp- and *.workspace files automatically. This seems to be solvable but other questions as mentioned above I have to solve also.
Regards
j.

Offline rioki

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Any easy way to add many search directory locations?
« Reply #6 on: August 31, 2009, 10:03:36 am »
There is a slightly hacky solution...

Open the cbp file in a text editor and add the include paths by hand. This is much faster if they follow a pattern. You can even write a small script to output them.

Warning: Remember to back up you file and close any CB instances that may have the file...