Code::Blocks Forums
User forums => Help => Topic started by: Jasper on May 24, 2010, 07:18:23 pm
-
Hi all,
I want to move all my source files from the project's location to a subdirectory (I don't want it in the same directory as .cpb, I don't want it in the same directory as bin, or anything else). How can I do this?
-
Remove thge files from project,
move them in a file explorer,
readd them to your project.
-
I can see that bit, but it will make my files appear in the project, but it won't make them work.
For example, this does not make includes work, as the path has changed. Now, I know that you can add the directory to the directory in which a include works, but if at all possible I would like to make the new dir my "root" directory as far as the source files are considered (for example, I also would like to get rid of the completely useless "source" folder in my project view, which is shown when using your way.
I can understand if it not possible to do what I want (though personally I would think that is shortcoming of Code::Blocks).
-
If your includes do not work anymore you have to fix the compilers search-directories, if you don't like the projects tree-structure, you can create virtual folders and drag the files you want into them.
-
Yes, that's what I was saying, I know that you can emulate some of the results I am looking for, but that's not what I want. You can change a lot of things for it to work almost the same, but you really can't achieve the same results as when the project file is in the very same directory as the source files are.
Also, I would like to say I consider your point about virtual directories to be rather nonsensical. So yes, I can drag every file to be displayed from what it would normally be. But I don't want to have to drag all my files. I just want a tree that isn't like this:
Sources
-source
--somefile.cpp
--anotherfile.cpp
Headers
-source
--somefile.h
--anotherfile.h
but like this:
Sources
-somefile.cpp
-anotherfile.cpp
Headers
-somefile.h
-anotherfile.h
-
I know that dragging the files one by one is not the best way to do so, but it is the only way at the moment (except for unchecking "Display folders as on disk" in the project's context-menu -> "Project tree", but that's most likely also not what you want).
But except from this issue the possible solution is more or less exactly what you described.
If you want something different, you should describe it more exactly, and post a feature request or better a patch at berlios.
-
You are right, this is the closest approximation. I guess I was just a bit ticked off because it was something I expected to be possible, yet instead of being told it wasn't really possible, I got an answer in the form of "this is the way to do that", while it was really only an approximation of what I was trying to do. The problem was in both my assumption that it was possible and the lack of clarity on my description. I'm sorry.
What I really want is for the "source root directory" not to necessarily be the same direction as the one your cbp file is in. Currently the folder in which your cbp file is, is your "source root directory" as well as (under default settings) parent of the bin directory etc.
Now that I think of it, there will only be a few changes necessary for this change:
- before executing the compiler, a cd to the "source root directory"
- the project panel should display things with the source root directory as its root
- the autocompletion should be aware of the include path
I'll look into making a feature request later. A patch would indeed be better, but seeing as I currently don't even have a home-compiled Code::Blocks and that I am in a rather large project, that isn't really a possibility for me right now.
-
If you put the sources under a "source" folder, then the object files will be
placed under "obj/source", even when in project options the object files
are set to be created in the "obj" sub-directory.
Is there a way to override this?
-
Anyone?
-
Anyone?
You can select "flat object hierarchy" in the advanced compiler settings. But be warned: this will overwrite object files with the same name. Usually this is a very bad thing to do.