[odb-users] Compilation errors

Tiago Macarios tiagomacarios at gmail.com
Mon Oct 3 20:40:47 EDT 2016


Hey Boris thanks again for the fast reply!

FYI: I applied your patch, but I think you forgot a semi-colon

pthread_detach (id_);




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


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).
If the file is really to be kept empty, this seems to be the "best"
solution I found to get rid of the warning: http://stackoverflow.co
m/a/1822931/997527 wdyt?


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.

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"

This prevents a couple of unknown pragma errors.


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

libtool: compile:  g++ -DHAVE_CONFIG_H -I../../libcommon -I../../libcommon
-DLIBCOMMON_DYNAMIC_LIB -I/mnt/c/Users/tmc/Downloads/libodb-2.5.0-a9
-I/mnt/c/Users/tmc/Downloads/libodb-sqlite-2.5.0-a9 -g -O2 -D_REENTRANT -MT
common.lo -MD -MP -MF .deps/common.Tpo -c common.cxx  -fPIC -DPIC -o
.libs/common.o
In file included from common.cxx:12:0:
../../libcommon/common/common.hxx:22:23: warning: 'template<class> class
std::auto_ptr' is deprecated [-Wdeprecated-declarations]
 LIBCOMMON_EXPORT std::auto_ptr<odb::database>
                       ^~~~~~~~
In file included from /usr/include/c++/6/memory:81:0,
                 from
/mnt/c/Users/tmc/Downloads/libodb-2.5.0-a9/odb/database.hxx:14,
                 from common.cxx:9:
/usr/include/c++/6/bits/unique_ptr.h:49:28: note: declared here
   template<typename> class auto_ptr;
                            ^~~~~~~~

I had a look at the code and I guess one could run it through clang-tidy,
but I see that you use #IFDEF HAVE_CXX11. Not sure clang-tidy will honor
that, but if you are open to patches I can give it a try.
http://clang.llvm.org/extra/clang-tidy/checks/modernize-replace-auto-ptr.html





On Mon, Oct 3, 2016 at 7:59 AM, Boris Kolpackov <boris at codesynthesis.com>
wrote:

> Hi Tiago,
>
> Tiago Macarios <tiagomacarios at gmail.com> writes:
>
> > I changed that destructor noexcept(false) to keep the old behavior.
>
> Thanks for the report. I've changed it not to throw so we don't go against
> the modern C++ grain ;-)
>
> http://scm.codesynthesis.com/?p=odb/libodb.git;a=commit;h=
> 8689838a9c90699f1cfede7fd549a2945b9295db
>
> Boris
>


More information about the odb-users mailing list