User forums > Using Code::Blocks

forcing Code::Blocks to put all .o files in same directory

<< < (2/3) > >>

davemalham:

--- Quote from: MortenMacFly on July 11, 2008, 02:29:08 pm ---
--- Quote from: davemalham on July 11, 2008, 11:12:52 am ---C::B still builds this directory structure in my /debug  folder which mimics the structure of the project's folders and puts the .o files in there - perhaps if I wait till Monday and try again then

--- End quote ---
This is by design. Consider the following project layout:

prj
- func1:
  - interfaces.cpp
- func2:
  - interfaces.cpp

You would not be able to compile this project with a flat object folder. That's exactly why sub-folders need and are being created.

--- End quote ---

Hi,
   I can see the usefulness of that, tho' I would personally be concerned by a project structure of that sort (I'm absolutely certain I would soon start confusing the different interfaces.cpp files) but, unless I am misunderstanding what you are saying, I would just rename the files to something like interfaces_f1.cpp and interfaces_f2.cpp. Setting that aside as it's really just a matter of personal preferences, wouldn't it be possible to have an option to do a flat compile, at least when an object file directory is explicitly given in the target properties. I started having a look at the C::B code last night with a view to adding that myself, but with the system starting to work this morning, I guess that isn't going to happen  :(

However, I do still need to get to the bottom of why it (gdb) wasn't working yesterday and is this morning on what, AFAICS, is the same project set-up. A colleague has suggested that this morning's m$ auto-update might have something to do with it, but I can't see that myself and unfortunately I did not keep a copy of the earlier .cdb file to check this. (Actually, strictly speaking, gdb was working yesterday, but only if I explicitly loaded the VST plugins files into gdb using the debug menu "send user command" function).

                  Dave

MortenMacFly:

--- Quote from: davemalham on July 11, 2008, 04:31:09 pm ---unless I am misunderstanding what you are saying, I would just rename the files to something like interfaces_f1.cpp and interfaces_f2.cpp.

--- End quote ---
Well - if you imagine func1 and func2 being actually a part of a 3rd party library (possibly coming from an external, non-self-managed repository) you cannot just rename these files. And in fact we have exactly that issue within the C::B project... just search for duplicate file names. ;-)

davemalham:

--- Quote from: MortenMacFly on July 11, 2008, 04:50:56 pm ---
--- Quote from: davemalham on July 11, 2008, 04:31:09 pm ---unless I am misunderstanding what you are saying, I would just rename the files to something like interfaces_f1.cpp and interfaces_f2.cpp.

--- End quote ---
Well - if you imagine func1 and func2 being actually a part of a 3rd party library (possibly coming from an external, non-self-managed repository) you cannot just rename these files. And in fact we have exactly that issue within the C::B project... just search for duplicate file names. ;-)

--- End quote ---

Okay, now I see the raison d'etre, and it makes a lot of sense - I hadn't been thinking on those lines. However, I still think it would be a useful option to be able to select for a flat compile for simple projects like the ones I'm dealing with so maybe I'll dig through the C::B sources a bit more and see if I can add this myself (all hints gratefully accepted). Meantime I'm still puzzled as to why it started working all of a sudden... :?

mandrav:
I know it's not in the most prominent place but it is really an advanced option so it's kinda hidden away.

Go "Settings->Compiler->["Other settings" tab]" and click "Advanced options". In the dialog that pops up, go to the "Others" tab and look near the bottom:

[*] Use flat objects, and
[*] Use full paths for source files (GDB workaround)

The first one "flattens" the object file (e.g. "src/main.o" becomes "src_main.o") and the second one uses full paths for compiling so GDB can find the source files no matter what...

davemalham:

--- Quote from: mandrav on July 14, 2008, 12:27:06 pm ---I know it's not in the most prominent place but it is really an advanced option so it's kinda hidden away.

Go "Settings->Compiler->["Other settings" tab]" and click "Advanced options". In the dialog that pops up, go to the "Others" tab and look near the bottom:

[*] Use flat objects, and
[*] Use full paths for source files (GDB workaround)

The first one "flattens" the object file (e.g. "src/main.o" becomes "src_main.o") and the second one uses full paths for compiling so GDB can find the source files no matter what...

--- End quote ---

 :oops: How did I miss that? Thanks....

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version