User forums > Using Code::Blocks
Making the creation of a cpp file dependand of a .h
Revvy:
I was trying Ceniza's suggestion to try to make Code::Blocks work the Qt and its moc build step, but the output target for .h files is locked as .h.pch or something like that. It didn't seem to be a very flexible system.
Ceniza:
I just tried adding a custom command to build the file, and it did it. My test command was: cmd /c copy $file $file.cpp. Maybe a few more extra macros would help to create custom build commands more easily, like $file_dir, or $file_noext...
Jenna:
--- Quote from: Revvy on March 08, 2008, 07:55:15 pm ---I was trying Ceniza's suggestion to try to make Code::Blocks work the Qt and its moc build step, but the output target for .h files is locked as .h.pch or something like that. It didn't seem to be a very flexible system.
--- End quote ---
I don't use Qt and therefore also not moc.
I looked in the moc-documentation to find out something about its command-line options.
If you right-click your .h-file (in the Manager) and chose properties you can create a coustom-build-command like "moc -E $file -o $file_dir/moc_$file_name.cpp" (tab "Advanced").
Don't forget to check compile on the "Build"-tab.
To make sure your moc_*.cpp file is created before compiling the other files you should decrease the priority-weight of the file (to 40 for example).
Other command macros you can use can be found under "Settings -> Compiler and Debugger -> Global Compiler Settings -> Other Settings (the right-most tab) -> Advanced Options".
As I wrote, I don't use Qt, so I could only test it with a .h file preprocessed with g++ instead of moc, that works fine, even it does not make much sense in the moment.
Navigation
[0] Message Index
[*] Previous page
Go to full version