[odb-users] Netbeans build error
Bright Dadson
losintikfos at yahoo.co.uk
Wed Feb 16 07:14:05 EST 2011
Thanks Boris - that was very useful.
Quick one though! I can compile Driver.cpp without any issues, but if i
right-click on the project name and select Build, I end up with below exception.
Do you know what what could be the issue?
----EXCEPTION------
build/Debug/GNU-Linux-x86/Member-odb.o:/usr/include/c++/4.4/exception:62:
multiple definition of
`odb::access::object_traits<test::Member>::query_type::id'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:138:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o:/usr/include/c++/4.4/exception:62:
multiple definition of
`odb::access::object_traits<test::Member>::query_type::title'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:138:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o:/usr/local/include/odb/details/buffer.hxx:39:
multiple definition of
`odb::access::object_traits<test::Member>::query_type::first_name'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:144:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o:/usr/local/include/odb/mysql/traits.hxx:107:
multiple definition of
`odb::access::object_traits<test::Member>::query_type::middle_name'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:144:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o:/usr/local/include/odb/details/shared-ptr/base.ixx:50:
multiple definition of
`odb::access::object_traits<test::Member>::query_type::last_name'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:144:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o:/usr/local/include/odb/mysql/transaction-impl.ixx:14:
multiple definition of
`odb::access::object_traits<test::Member>::query_type::dob'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:144:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o:/usr/local/include/odb/details/type-info.hxx:33:
multiple definition of
`odb::access::object_traits<test::Member>::query_type::join_date'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:144:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0xf8): multiple definition of
`odb::access::object_traits<test::Member>::persist_statement'
build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0xf8): first defined here
build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x1b0): multiple definition of
`odb::access::object_traits<test::Member>::find_statement'
build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x1b0): first defined here
build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x284): multiple definition of
`odb::access::object_traits<test::Member>::update_statement'
build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x284): first defined here
build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x2b8): multiple definition of
`odb::access::object_traits<test::Member>::erase_statement'
build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x2b8): first defined here
build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x358): multiple definition of
`odb::access::object_traits<test::Member>::query_clause'
build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x358): first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::access::object_traits<test::Member>::id(odb::access::object_traits<test::Member>::image_type
const&)':
/usr/include/c++/4.4/exception:62: multiple definition of
`odb::access::object_traits<test::Member>::id(odb::access::object_traits<test::Member>::image_type
const&)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:138:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::access::object_traits<test::Member>::grow(odb::access::object_traits<test::Member>::image_type&,
char*)':
/usr/local/include/odb/mysql/traits.hxx:110: multiple definition of
`odb::access::object_traits<test::Member>::grow(odb::access::object_traits<test::Member>::image_type&,
char*)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:151:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::access::object_traits<test::Member>::bind(st_mysql_bind*,
odb::access::object_traits<test::Member>::image_type&, bool)':
/root/Documents/project/mefam/Member-odb.cxx:204: multiple definition of
`odb::access::object_traits<test::Member>::bind(st_mysql_bind*,
odb::access::object_traits<test::Member>::image_type&, bool)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:204:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::access::object_traits<test::Member>::bind(st_mysql_bind*,
odb::access::object_traits<test::Member>::id_image_type&)':
/root/Documents/project/mefam/Member-odb.cxx:276: multiple definition of
`odb::access::object_traits<test::Member>::bind(st_mysql_bind*,
odb::access::object_traits<test::Member>::id_image_type&)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:276:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::access::object_traits<test::Member>::init(odb::access::object_traits<test::Member>::image_type&,
test::Member const&)':
/root/Documents/project/mefam/Member-odb.cxx:286: multiple definition of
`odb::access::object_traits<test::Member>::init(odb::access::object_traits<test::Member>::image_type&,
test::Member const&)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:286:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::access::object_traits<test::Member>::init(test::Member&,
odb::access::object_traits<test::Member>::image_type const&, odb::database&)':
/root/Documents/project/mefam/Member-odb.cxx:407: multiple definition of
`odb::access::object_traits<test::Member>::init(test::Member&,
odb::access::object_traits<test::Member>::image_type const&, odb::database&)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:407:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::access::object_traits<test::Member>::init(odb::access::object_traits<test::Member>::id_image_type&,
unsigned long const&)':
/root/Documents/project/mefam/Member-odb.cxx:481: multiple definition of
`odb::access::object_traits<test::Member>::init(odb::access::object_traits<test::Member>::id_image_type&,
unsigned long const&)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:481:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::access::object_traits<test::Member>::persist(odb::database&,
test::Member&)':
/root/Documents/project/mefam/Member-odb.cxx:495: multiple definition of
`odb::access::object_traits<test::Member>::persist(odb::database&,
test::Member&)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:495:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::access::object_traits<test::Member>::update(odb::database&, test::Member
const&)':
/root/Documents/project/mefam/Member-odb.cxx:523: multiple definition of
`odb::access::object_traits<test::Member>::update(odb::database&, test::Member
const&)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:523:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::access::object_traits<test::Member>::erase(odb::database&, unsigned long
const&)':
/root/Documents/project/mefam/Member-odb.cxx:557: multiple definition of
`odb::access::object_traits<test::Member>::erase(odb::database&, unsigned long
const&)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:557:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::access::object_traits<test::Member>::find(odb::database&, unsigned long
const&)':
/root/Documents/project/mefam/Member-odb.cxx:582: multiple definition of
`odb::access::object_traits<test::Member>::find(odb::database&, unsigned long
const&)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:582:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::access::object_traits<test::Member>::find_(odb::mysql::object_statements<test::Member>&,
unsigned long const&)':
/root/Documents/project/mefam/Member-odb.cxx:653: multiple definition of
`odb::access::object_traits<test::Member>::find_(odb::mysql::object_statements<test::Member>&,
unsigned long const&)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:653:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::access::object_traits<test::Member>::find(odb::database&, unsigned long
const&, test::Member&)':
/root/Documents/project/mefam/Member-odb.cxx:620: multiple definition of
`odb::access::object_traits<test::Member>::find(odb::database&, unsigned long
const&, test::Member&)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:620:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::result<test::Member>
odb::access::object_traits<test::Member>::query<test::Member>(odb::database&,
odb::access::object_traits<test::Member>::query_type const&)':
/root/Documents/project/mefam/Member-odb.cxx:704: multiple definition of
`odb::result<test::Member>
odb::access::object_traits<test::Member>::query<test::Member>(odb::database&,
odb::access::object_traits<test::Member>::query_type const&)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:704:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::access::object_traits<test::Member>::query_(odb::database&,
odb::access::object_traits<test::Member>::query_type const&,
odb::mysql::object_statements<test::Member>&,
odb::details::shared_ptr<odb::mysql::select_statement>&)':
/root/Documents/project/mefam/Member-odb.cxx:747: multiple definition of
`odb::access::object_traits<test::Member>::query_(odb::database&,
odb::access::object_traits<test::Member>::query_type const&,
odb::mysql::object_statements<test::Member>&,
odb::details::shared_ptr<odb::mysql::select_statement>&)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:747:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::result<test::Member
const> odb::access::object_traits<test::Member>::query<test::Member
const>(odb::database&, odb::access::object_traits<test::Member>::query_type
const&)':
/root/Documents/project/mefam/Member-odb.cxx:726: multiple definition of
`odb::result<test::Member const>
odb::access::object_traits<test::Member>::query<test::Member
const>(odb::database&, odb::access::object_traits<test::Member>::query_type
const&)'
build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:726:
first defined here
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::raw_ptr_guard<test::Member*>::~raw_ptr_guard()':
Member-odb.cxx:(.text._ZN3odb13raw_ptr_guardIPN6test6MemberEED1Ev[odb::raw_ptr_guard<test::Member*>::~raw_ptr_guard()]+0x14):
undefined reference to `test::Member::~Member()'
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::access::pointer_factory<test::Member, test::Member*>::create()':
Member-odb.cxx:(.text._ZN3odb6access15pointer_factoryIN6test6MemberEPS3_E6createEv[odb::access::pointer_factory<test::Member,
test::Member*>::create()]+0x4b): undefined reference to
`test::Member::Member()'
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::raw_ptr_guard<test::Member const*>::~raw_ptr_guard()':
Member-odb.cxx:(.text._ZN3odb13raw_ptr_guardIPKN6test6MemberEED1Ev[odb::raw_ptr_guard<test::Member
const*>::~raw_ptr_guard()]+0x14): undefined reference to
`test::Member::~Member()'
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::raw_ptr_guard<test::Member const*>::reset(test::Member const*)':
Member-odb.cxx:(.text._ZN3odb13raw_ptr_guardIPKN6test6MemberEE5resetES4_[odb::raw_ptr_guard<test::Member
const*>::reset(test::Member const*)]+0x14): undefined reference to
`test::Member::~Member()'
build/Debug/GNU-Linux-x86/Member-odb.o: In function
`odb::raw_ptr_guard<test::Member*>::reset(test::Member*)':
Member-odb.cxx:(.text._ZN3odb13raw_ptr_guardIPN6test6MemberEE5resetES3_[odb::raw_ptr_guard<test::Member*>::reset(test::Member*)]+0x14):
undefined reference to `test::Member::~Member()'
build/Debug/GNU-Linux-x86/Driver.o: In function `main':
/root/Documents/project/mefam/Driver.cpp:32: undefined reference to
`test::Member::Member()'
/root/Documents/project/mefam/Driver.cpp:33: undefined reference to
`test::Member::setFirstName(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >)'
/root/Documents/project/mefam/Driver.cpp:34: undefined reference to
`test::Member::setLastName(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >)'
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/mefam] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)
________________________________
From: Boris Kolpackov <boris at codesynthesis.com>
To: Bright Dadson <losintikfos at yahoo.co.uk>
Cc: odb-users at codesynthesis.com
Sent: Wed, 16 February, 2011 6:20:29
Subject: Re: [odb-users] Netbeans build error
Hi,
Bright Dadson <losintikfos at yahoo.co.uk> writes:
> I have attached a copy of the project.
I took a look at your makefiles, and I see you are running the ODB
compiler like this:
odb -d mysql --generate-query --generate-schema Member.cpp
The ODB compiler should be invoked on the header file that defines
the persistent classes, not the source file. So the above command
line should be:
odb -d mysql --generate-query --generate-schema Member.h
The other thing that I had to fix to make the resulting code compile
is to qualify the 'access' class in the friend declaration:
friend class odb::access;
If you just do :
namespace N
{
using namespace odb;
class Member
{
friend class access;
};
}
The C++ compiler assumes 'access' refers to a (yet undefined) class in
namespace 'N'.
After these two changes I was able to compile your code without any
problems.
Boris
More information about the odb-users
mailing list