[odb-users] error: redefinition of ‘bool odb::create_schema
Boris Kolpackov
boris at codesynthesis.com
Wed Sep 3 09:46:18 EDT 2014
Hi Willem,
WA van Doesburg <wvandoesburg at gmail.com> writes:
> I’m using cmake as my build system. In order to only have to change
> my code and not my CMakeList.txt each time I add a persistable class
> I’m including the generated -odb.cxx files to my own .cxx files where
> I’m using that class.
Yeah, you should have mentioned that from the beginning.
> Apparently this produces the name clash.
>
> So the my question is why is this producing the name clash?
My guess is if you include two -odb.cxx files into the same .cxx file,
then you will end up with two identically-named static functions in
the same translation unit. I am surprised you didn't get a compile
error to this effect.
> And, is there a way to automatically update my CMakeList.txt based on
> the output of my ODB build step?
The output of the ODB compiler is very regular. You pass it foo.hxx,
it produces foo-odb.{h,i,c}xx. Surely it is possible in CMake to take
a list of files in the form "foo.hxx bar.hxx" and transform it to a
list in the form "foo-odb.cxx bar-odb.cxx".
If that doesn't work for you for some reason, you may want to look
into the --at-once ODB compiler option. This way you can generate one
giant -odb.cxx file for all your header files.
Boris
More information about the odb-users
mailing list