User forums > Using Code::Blocks
Best way to integrate an "Other" file
MortenMacFly:
--- Quote from: burtbick on January 08, 2012, 01:37:21 am ---I'd already tried different settings for the priority weight.
--- End quote ---
This really should work. Note that files with a lower value will be build first!
burtbick:
Thanks,
I'll try experimenting with it again. I only changed it on the protocol file and it didn't appear to change the behavior.
If I edit the protocol file and hit the build button the protocol file is compiled and the .C and .H files are generated. But then the build completes without building the files that depend on the newly generated .H file (and the newly generated .C file).
If I immediately hit build again then all of the files that depend on the generated .H file are built, as well as the newly generated .C file and the executable is built.
The macro I used to specify the build is the 'Build one file...' but that was the same one that was used in the two examples from the Wiki so I would expect that to be correct.
Regards,
Burt
stahta01:
What macro did you put in the box below that covers generated files?
Tim S.
burtbick:
Hi Tim,
From the Advanced Options Dialog
Source ext: proto
Command:
'Compile single file to object file'
protoc-c --c_out=. $file_name.proto
Generated Files:
$file_dir/$file_name.pb-c.c
$file_dir/$file_name.pb-c.h
Note: I've tried it with and without the .h
Close project and reopen between changes to Advanced Options.
Looking closer at what C:B is doing when I edit the protocol file and build:
* Get to a clean build state where everything is update to date.
* Edit protocol file to change a member name which will cause a compile error from one of the project files that doesn't know the new name.
* Proto file compiles, generates .H and .C files. But the files that include the generated .H do not get compiled and linked.
* Hit build again, the files that include .H are compiled and in this case I get the error I induced.
Edit proto file again to fix error.
* Hit build.
* Proto file compiles, generates .H and .C files.
* C file that failed on previous build is also compiled in this case but none of the other .C files that include the generated .H file get compiled.
After build finishes "successfully"
* Hit build again.
* The other .C files that include the generated .H are compiled and linked.
Protocol source file Build priority weight at 20% so it should build ahead of the others, and generate the .H file (and .C) file before compiling others. I would expect that this would have the .H file available for the rest of the project to then scan. I'm thinking that perhaps C:B does the dependency scan before the build starts, and doesn't realize that the Protocol compile step is going to change things by generating new files that the rest of the project depend on. Could that be what is happening, since it seems to fit if you follow the steps above?
If so is there a way with in the project to regenerate the dependencies after the protocol compile step completes? And if so is there a good example of how to do that somewhere in the docs that I haven't seen?
Thanks,
Burt
MortenMacFly:
--- Quote from: burtbick on January 08, 2012, 06:14:26 pm ---Generated Files:
$file_dir/$file_name.pb-c.c
$file_dir/$file_name.pb-c.h
--- End quote ---
Did you add them to the project (once they are created) and leave the project as it is (even they are not there - and flagged as missing)?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version