[odb-users] Compilation errors

Boris Kolpackov boris at codesynthesis.com
Tue Oct 4 10:54:56 EDT 2016


Hi Tiago,

Tiago Macarios <tiagomacarios at gmail.com> writes:

> FYI: I applied your patch, but I think you forgot a semi-colon
> 
> pthread_detach (id_);

Right, I thought I've tested it but turns out it was C++11 threads
configuration.


> I am integrating ODB to our build system, so I will be reporting a couple
> more things. Hope you don't mind.

Sure, we always appreciate bug reports.


> 1 - When compiling libodb on Visual Studio I am getting:
> 
> condition.obj : warning LNK4221: This object file does not define any
> previously undefined public symbols, so it will not be used by any link
> operation that consumes this library
> 
> I had a look at condition.cxx and it seems like it is empty on purpose, but
> I don't really understand why (even though there is some text trying to
> explain, sorry about that).

This is the Windows DLL symbol exporting "brain-death". Currently the ODB
approach is to export inline functions which sometimes requires having a
dummy source file so that they are actually "seen" and exported by the
compiler.

In build2 builds we have switched to not exporting inline functions by
default. We are probably not going to back-port it to the VC projects
since there is no guarantee all the old version of VC will be happy.

But this warning is harmless and you can ignore it.


> 2 - In the mapping example examples/mapping/traits-sqlite.hxx, shouldn't
> 
> #include "person.hxx" // date
> 
> be between a "pre" and "post"?
> 
> #include <odb/pre.hxx>
> #include "person.hxx" // date
> #include <odb/post.hxx>
> 
> The above fixes a couple of unknown pragma issues.

We try to keep examples as pure as possible so that the code can be used
directly in user applications. In build2 we will suppress them with cl
option from buildfile.


> 3 - More of a question, but on the examples and tests why do you include
> the files on this order:
> 
> #include "person.hxx"
> #include "person-odb.hxx"
> 
> I guess you wouldn't even need the "person.hxx" since "person-odb.hxx"
> includes "person.hxx", but in case you keep both, why not flip the order:
> 
> #include "person-odb.hxx"
> #include "person.hxx"

Flipping the order is a matter of style. We try to include more general
headers first. As for why include both, again, our style is to explicitly
include everything we use.


> 4 - When using GCC I get a fair bit of warnings on the examples about the
> use of auto_ptr,

Yes, this can only get fixed once we drop C++98 support, which we plan to
do as soon as we release the next version.

Boris



More information about the odb-users mailing list