User forums > Using Code::Blocks
cbp2make - makefile generation tool
mirai:
Currently cbp2make doesn't make any difference between static and dynamic libraries when it is about to generate a line for the linker.
Well, my assumption about how this should work was wrong and this is why it is designed that way.
Input conditions are: ( ) a library has a known extension ( ) static ( ) dynamic ( ) any other extension ( ) no extension ( ) a library has a known prefix;
Possible actions: ( ) remove prefix ( ) remove extension ( ) add library linking switch;
the.sniffer, could you write down the required logic in these terms as you see it? (like you did on stackoverflow.com)
the.sniffer:
I'd suggest you have a look at "src/sdk/compilercommandgenerator.cpp" in CodeBlocks source code for the most accurate response. There are a lot of options that come into play, and I'd hate to make a mistake.
m.rap:
this is really a great tool. in the previous version i got nothing wrong, but this latest one i have this problem:
i have static library project, for example the name is "abc". in the project properties it's already set that the output filename is "bin/Debug/libabc.a". but when i generate the makefile using cbp2make and build it, the output file is generated with the name "liblibabc.a" instead of "libabc.a". it results the linking process failed because the linker cannot find the library abc. why does it happen? or is there any workaround to fix this? thanks
EDIT:
apologies. as it turns out, i just realized that the version of codeblocks i used was 10.05 which i got from the wheezy distribution of debian. in this version the output file explicitly set as "libabc" unlike on the version 13.12 that just set as "abc".
fruitCode:
I have a workspace with 2 projects, one uses the MINGW GCC to build it and the other uses MINGW64 to build.
Actually these projects deliver a DLL, one for 32 bit and one for 64 bit.
cpb2make does not generate a makefile for the 64 bit project, it trows the error message:
Warning: toolchain 'gnu_gcc_compiler_w64' for target 'DLL' is not defined.
In code::blocks I defined the 64 compiler using the menu settings->compiler (as described in this clear expanation (thanks!!) http://yzhong.co/?p=622)
I can see one can add a configuration but how to do it? How does a configuration file look like? I looked at the output of cbp2make --config show but there is no folder location mentioned. I suppose I have to tell it through the configuration file where the compiler/linker is located? (Since I have two versions of MINGW on my computer)
mirai:
fruitCode
Compiler settings from C::B are not transferred to cbp2make.cfg automatically, you have to specify options separately from C::B.
Run cbp2make --config --local , this will create cbp2make.cfg file in the current directory. Then you can edit this XML file either with a regular text editor or by running cbp2make with certain options. I think using a text editor would be easier.
Find a section like this
--- Code: --- <toolchain platform="Windows" alias="gcc">
<tool type="compiler" alias="gnu_c_compiler">
<option description="GNU C Compiler" />
<option program="gcc.exe" />
<option make_variable="CC" />
<option command_template="$compiler $options $includes -c $file -o $object" />
<option source_extensions="c cc" />
<option target_extension="o" />
<option need_quoted_path="0" />
<option need_full_path="0" />
<option need_unix_path="0" />
<option include_dir_switch="-I" />
<option define_switch="-D" />
</tool>
<tool type="compiler" alias="gnu_cpp_compiler">
<option description="GNU C++ Compiler" />
<option program="g++.exe" />
<option make_variable="CXX" />
<option command_template="$compiler $options $includes -c $file -o $object" />
<option source_extensions="cpp cxx" />
<option target_extension="o" />
<option need_quoted_path="0" />
<option need_full_path="0" />
<option need_unix_path="0" />
<option include_dir_switch="-I" />
<option define_switch="-D" />
</tool>
<tool type="static_library_linker" alias="gnu_static_linker">
<option description="GNU Static Library Linker" />
<option program="ar.exe" />
<option make_variable="AR" />
<option command_template="$lib_linker rcs $static_output $link_objects" />
<option source_extensions="o obj" />
<option target_extension="a" />
<option need_quoted_path="0" />
<option need_full_path="0" />
<option need_unix_path="0" />
<option library_dir_switch="-L" />
<option link_library_switch="-l" />
<option object_extension="o" />
<option library_prefix="lib" />
<option library_extension="a" />
<option need_library_prefix="0" />
<option need_library_extension="0" />
<option need_flat_objects="0" />
</tool>
<tool type="dynamic_library_linker" alias="gnu_dynamic_linker">
<option description="GNU Dynamic Library Linker" />
<option program="g++.exe" />
<option make_variable="LD" />
<option command_template="$linker -shared $link_options $libdirs $link_objects $libs -o $exe_output" />
<option source_extensions="o obj" />
<option target_extension="dll" />
<option need_quoted_path="0" />
<option need_full_path="0" />
<option need_unix_path="0" />
<option library_dir_switch="-L" />
<option link_library_switch="-l" />
<option object_extension="o" />
<option library_prefix="lib" />
<option library_extension="dll" />
<option need_library_prefix="0" />
<option need_library_extension="0" />
<option need_flat_objects="0" />
</tool>
<tool type="executable_binary_linker" alias="gnu_executable_linker">
<option description="GNU Executable Binary Linker" />
<option program="g++.exe" />
<option make_variable="LD" />
<option command_template="$linker $link_options $libdirs $link_objects $libs -o $exe_output" />
<option source_extensions="o obj" />
<option target_extension="exe" />
<option need_quoted_path="0" />
<option need_full_path="0" />
<option need_unix_path="0" />
<option library_dir_switch="-L" />
<option link_library_switch="-l" />
<option object_extension="o" />
<option library_prefix="" />
<option library_extension="" />
<option need_library_prefix="0" />
<option need_library_extension="0" />
<option need_flat_objects="0" />
<option option_wingui="-mwindows" />
</tool>
<tool type="resource_compiler" alias="gnu_windres_compiler">
<option description="GNU Windows Resource Compiler" />
<option program="windres.exe" />
<option make_variable="WINDRES" />
<option command_template="$rescomp -i $file -J rc -o $resource_output -O coff $includes" />
<option source_extensions="rc res coff" />
<option target_extension="o" />
<option need_quoted_path="0" />
<option need_full_path="0" />
<option need_unix_path="0" />
<option include_dir_switch="-I" />
<option define_switch="-D" />
</tool>
</toolchain>
--- End code ---
Copy this text next to itself and replace the value of "alias" option with exactly the same text as in .cbp file in line "<Option compiler = "gcc">", then modify options of build tools to match C::B settings.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version