Thread: [Cppcms-users] Starting with DbiXX
Brought to you by:
artyom-beilis
From: augustin <aug...@ov...> - 2010-07-14 11:43:40
|
Hello, Is the DbiXX documentation up to date? http://art-blog.no-ip.info/wikipp/en/page/tut_into_dbixx I see that the last edit dates back to 2008. I followed the instructions to install the DbiXX libs and I think I installed it properly. But I cannot compile the exact same example as given at the top of the tutorial above. See the compiler output at the bottom. I thought it was again a library path problem and tried various combination of the advice you gave me previously ( export LD_LIBRARY_PATH=/usr/local/lib etc.) but to no avail. Since the compiling method seems different, I'm not too sure how to proceed. $ c++ ../sql_test.cpp -o SQL /tmp/ccAkCTv1.o: In function `main': sql_test.cpp:(.text+0x41): undefined reference to `dbixx::session::session(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' sql_test.cpp:(.text+0xab): undefined reference to `dbixx::session::~session()' sql_test.cpp:(.text+0x10a): undefined reference to `dbixx::session::param(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' sql_test.cpp:(.text+0x201): undefined reference to `dbixx::session::param(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' sql_test.cpp:(.text+0x28d): undefined reference to `dbixx::session::connect()' sql_test.cpp:(.text+0x324): undefined reference to `dbixx::session::exec()' sql_test.cpp:(.text+0x3c7): undefined reference to `dbixx::session::exec()' sql_test.cpp:(.text+0x60a): undefined reference to `dbixx::session::single(dbixx::row&)' sql_test.cpp:(.text+0x76c): undefined reference to `dbixx::session::fetch(dbixx::result&)' sql_test.cpp:(.text+0x799): undefined reference to `dbixx::result::rows()' sql_test.cpp:(.text+0x880): undefined reference to `dbixx::result::next(dbixx::row&)' sql_test.cpp:(.text+0x897): undefined reference to `dbixx::result::~result()' sql_test.cpp:(.text+0x8ad): undefined reference to `dbixx::result::~result()' sql_test.cpp:(.text+0x8c4): undefined reference to `dbixx::row::~row()' sql_test.cpp:(.text+0x8da): undefined reference to `dbixx::row::~row()' sql_test.cpp:(.text+0x8f1): undefined reference to `dbixx::session::~session()' sql_test.cpp:(.text+0x907): undefined reference to `dbixx::session::~session()' /tmp/ccAkCTv1.o: In function `dbixx::session::bind(int const&, bool)': sql_test.cpp:(.text._ZN5dbixx7session4bindERKib[dbixx::session::bind(int const&, bool)]+0x34): undefined reference to `dbixx::session::bind(long long const&, bool)' /tmp/ccAkCTv1.o: In function `dbixx::session::operator<<(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': sql_test.cpp: (.text._ZN5dbixx7sessionlsERKSs[dbixx::session::operator<<(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x1f): undefined reference to `dbixx::session::query(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /tmp/ccAkCTv1.o: In function `dbixx::session::operator,(dbixx::exec const&)': sql_test.cpp:(.text._ZN5dbixx7sessioncmERKNS_4execE[dbixx::session::operator, (dbixx::exec const&)]+0x18): undefined reference to `dbixx::session::exec()' /tmp/ccAkCTv1.o: In function `dbixx::session& dbixx::session::operator,<char const*>(char const*)': sql_test.cpp:(.text._ZN5dbixx7sessioncmIPKcEERS0_T_[dbixx::session& dbixx::session::operator,<char const*>(char const*)]+0x4a): undefined reference to `dbixx::session::bind(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)' /tmp/ccAkCTv1.o: In function `dbixx::row& dbixx::row::operator>><std::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)': sql_test.cpp:(.text._ZN5dbixx3rowrsISsEERS0_RT_[dbixx::row& dbixx::row::operator>><std::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)]+0x36): undefined reference to `dbixx::row::fetch(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' /tmp/ccAkCTv1.o: In function `dbixx::row& dbixx::row::operator>><int>(int&)': sql_test.cpp:(.text._ZN5dbixx3rowrsIiEERS0_RT_[dbixx::row& dbixx::row::operator>><int>(int&)]+0x36): undefined reference to `dbixx::row::fetch(int, int&)' collect2: ld returned 1 exit status -- Friends: http://www.reuniting.info/ http://activistsolutions.org/ My projects: http://astralcity.org/ http://3enjeux.overshoot.tv/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://www.wechange.org/ http://searching911.info/ . |
From: Daniel V. <chi...@gm...> - 2010-07-14 16:35:46
|
Hello, The problem is that you are not linking the dbixx library. The command is (for gcc) c++ ../sql_test.cpp -o SQL -L/path/to/dbixx_library -ldbixx You should read more about linking libraries. Good luck! On Wed, 2010-07-14 at 19:42 +0800, augustin wrote: > Hello, > > Is the DbiXX documentation up to date? > http://art-blog.no-ip.info/wikipp/en/page/tut_into_dbixx > I see that the last edit dates back to 2008. > > I followed the instructions to install the DbiXX libs and I think I installed > it properly. > But I cannot compile the exact same example as given at the top of the > tutorial above. See the compiler output at the bottom. > > I thought it was again a library path problem and tried various combination of > the advice you gave me previously ( export LD_LIBRARY_PATH=/usr/local/lib > etc.) but to no avail. > > Since the compiling method seems different, I'm not too sure how to proceed. > > > $ c++ ../sql_test.cpp -o SQL > /tmp/ccAkCTv1.o: In function `main': > sql_test.cpp:(.text+0x41): undefined reference to > `dbixx::session::session(std::basic_string<char, std::char_traits<char>, > std::allocator<char> > const&)' > sql_test.cpp:(.text+0xab): undefined reference to `dbixx::session::~session()' > sql_test.cpp:(.text+0x10a): undefined reference to > `dbixx::session::param(std::basic_string<char, std::char_traits<char>, > std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, > std::allocator<char> > const&)' > sql_test.cpp:(.text+0x201): undefined reference to > `dbixx::session::param(std::basic_string<char, std::char_traits<char>, > std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, > std::allocator<char> > const&)' > sql_test.cpp:(.text+0x28d): undefined reference to `dbixx::session::connect()' > sql_test.cpp:(.text+0x324): undefined reference to `dbixx::session::exec()' > sql_test.cpp:(.text+0x3c7): undefined reference to `dbixx::session::exec()' > sql_test.cpp:(.text+0x60a): undefined reference to > `dbixx::session::single(dbixx::row&)' > sql_test.cpp:(.text+0x76c): undefined reference to > `dbixx::session::fetch(dbixx::result&)' > sql_test.cpp:(.text+0x799): undefined reference to `dbixx::result::rows()' > sql_test.cpp:(.text+0x880): undefined reference to > `dbixx::result::next(dbixx::row&)' > sql_test.cpp:(.text+0x897): undefined reference to `dbixx::result::~result()' > sql_test.cpp:(.text+0x8ad): undefined reference to `dbixx::result::~result()' > sql_test.cpp:(.text+0x8c4): undefined reference to `dbixx::row::~row()' > sql_test.cpp:(.text+0x8da): undefined reference to `dbixx::row::~row()' > sql_test.cpp:(.text+0x8f1): undefined reference to `dbixx::session::~session()' > sql_test.cpp:(.text+0x907): undefined reference to `dbixx::session::~session()' > /tmp/ccAkCTv1.o: In function `dbixx::session::bind(int const&, bool)': > sql_test.cpp:(.text._ZN5dbixx7session4bindERKib[dbixx::session::bind(int > const&, bool)]+0x34): undefined reference to `dbixx::session::bind(long long > const&, bool)' > /tmp/ccAkCTv1.o: In function > `dbixx::session::operator<<(std::basic_string<char, std::char_traits<char>, > std::allocator<char> > const&)': > sql_test.cpp: > (.text._ZN5dbixx7sessionlsERKSs[dbixx::session::operator<<(std::basic_string<char, > std::char_traits<char>, std::allocator<char> > const&)]+0x1f): undefined > reference to `dbixx::session::query(std::basic_string<char, > std::char_traits<char>, std::allocator<char> > const&)' > /tmp/ccAkCTv1.o: In function `dbixx::session::operator,(dbixx::exec const&)': > sql_test.cpp:(.text._ZN5dbixx7sessioncmERKNS_4execE[dbixx::session::operator, > (dbixx::exec const&)]+0x18): undefined reference to `dbixx::session::exec()' > /tmp/ccAkCTv1.o: In function `dbixx::session& dbixx::session::operator,<char > const*>(char const*)': > sql_test.cpp:(.text._ZN5dbixx7sessioncmIPKcEERS0_T_[dbixx::session& > dbixx::session::operator,<char const*>(char const*)]+0x4a): undefined reference > to `dbixx::session::bind(std::basic_string<char, std::char_traits<char>, > std::allocator<char> > const&, bool)' > /tmp/ccAkCTv1.o: In function `dbixx::row& > dbixx::row::operator>><std::basic_string<char, std::char_traits<char>, > std::allocator<char> > >(std::basic_string<char, std::char_traits<char>, > std::allocator<char> >&)': > sql_test.cpp:(.text._ZN5dbixx3rowrsISsEERS0_RT_[dbixx::row& > dbixx::row::operator>><std::basic_string<char, std::char_traits<char>, > std::allocator<char> > >(std::basic_string<char, std::char_traits<char>, > std::allocator<char> >&)]+0x36): undefined reference to `dbixx::row::fetch(int, > std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' > /tmp/ccAkCTv1.o: In function `dbixx::row& dbixx::row::operator>><int>(int&)': > sql_test.cpp:(.text._ZN5dbixx3rowrsIiEERS0_RT_[dbixx::row& > dbixx::row::operator>><int>(int&)]+0x36): undefined reference to > `dbixx::row::fetch(int, int&)' > collect2: ld returned 1 exit status > > > > |
From: augustin <aug...@ov...> - 2010-07-14 21:25:20
|
On Thursday 15 July 2010 12:35:24 am Daniel Vallejos wrote: > The problem is that you are not linking the dbixx library. > > The command is (for gcc) > > c++ ../sql_test.cpp -o SQL -L/path/to/dbixx_library -ldbixx > > You should read more about linking libraries. > Thanks a lot Daniel. It now works using the mysql backend: overshoot@Augustin:~/git/cppcms/build$ c++ ../sql_test.cpp -o SQL -L /usr/local/include/dbixx/dbixx.h -ldbixx overshoot@Augustin:~/git/cppcms/build$ ./SQL Moshe There are 2 users 1 Moshe 2 Yossi I appreciate a lot the pointer about linked libraries. As I said earlier, I am new with C++ and there are some concepts I do not fully grasp yet (the compiling aspect is barely covered at all in all the tutorials and manuals I have read so far. All focus on the C++ language itself). I have been perusing such sites as: http://en.wikibooks.org/wiki/C++_Programming http://www.cplusplus.com/ and others. (You're welcome to share your favourite C++ reference web site). And now that I know what to look for, I am about to study this: http://linuxmafia.com/faq/Admin/ld-lib-path.html (They say: don't use LD_LIBRARY_PATH) http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html http://www.cplusplus.com/query/search.cgi?q=linking+libraries :) Thanks again, Augustin. -- Friends: http://www.reuniting.info/ http://activistsolutions.org/ My projects: http://astralcity.org/ http://3enjeux.overshoot.tv/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://www.wechange.org/ http://searching911.info/ . |
From: Daniel V. <chi...@gm...> - 2010-07-15 00:59:17
|
You are welcome. I recommend http://www.network-theory.co.uk/docs/gccintro/index.html Specially the sections: 2.7 Linking with external libraries 11 How the compiler works. Also note that -L flag is for directories that contains statics libraries (.a) or dynamic libraries (.so "shared object"). Not for headers files (-L/usr/local/include/dbixx/dbixx.h). Also note, LD_LIBRARY_PATH is for runtime linking, not for compile time linking. When you fully understand how the preprocessor, the compiler and linker works, the next step is learning to use a build system such as cmake. This save a lot of time. And finally, the next step is use a IDE. I strongly recommend kdevelop 4. Regards. On Thu, 2010-07-15 at 05:23 +0800, augustin wrote: > On Thursday 15 July 2010 12:35:24 am Daniel Vallejos wrote: > > The problem is that you are not linking the dbixx library. > > > > The command is (for gcc) > > > > c++ ../sql_test.cpp -o SQL -L/path/to/dbixx_library -ldbixx > > > > You should read more about linking libraries. > > > > Thanks a lot Daniel. > > It now works using the mysql backend: > > overshoot@Augustin:~/git/cppcms/build$ c++ ../sql_test.cpp -o SQL -L > /usr/local/include/dbixx/dbixx.h -ldbixx > overshoot@Augustin:~/git/cppcms/build$ ./SQL > Moshe > There are 2 users > 1 Moshe > 2 Yossi > > I appreciate a lot the pointer about linked libraries. As I said earlier, I am > new with C++ and there are some concepts I do not fully grasp yet (the > compiling aspect is barely covered at all in all the tutorials and manuals I > have read so far. All focus on the C++ language itself). > > I have been perusing such sites as: > http://en.wikibooks.org/wiki/C++_Programming > http://www.cplusplus.com/ > and others. > (You're welcome to share your favourite C++ reference web site). > > And now that I know what to look for, I am about to study this: > http://linuxmafia.com/faq/Admin/ld-lib-path.html (They say: don't use > LD_LIBRARY_PATH) > http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html > http://www.cplusplus.com/query/search.cgi?q=linking+libraries > > :) > > Thanks again, > > Augustin. > > > |
From: augustin <aug...@ov...> - 2010-07-15 05:21:52
|
Hi Daniel, On Thursday 15 July 2010 08:59:05 am Daniel Vallejos wrote: > I recommend > > http://www.network-theory.co.uk/docs/gccintro/index.html > > Specially the sections: > > 2.7 Linking with external libraries > 11 How the compiler works. Woah! That's exactly what I was missing. :) I've already spent the last few hours reading it (slowly) starting from the very beginning. I'll study it throughout carefully. > Also note that -L flag is for directories that contains statics > libraries (.a) or dynamic libraries (.so "shared object"). Not for > headers files (-L/usr/local/include/dbixx/dbixx.h). I had the feeling I was doing something wrong... Thanks for correcting me. > When you fully understand how the preprocessor, the compiler and linker > works, the next step is learning to use a build system such as cmake. > This save a lot of time. Yep. That's one of the first things on my TODO list. I've made a small start already. > And finally, the next step is use a IDE. I > strongly recommend kdevelop 4. All these years, I've been using vim to code in PHP. I liked it enough. Someone recently recommended Eclipse Helios (on the Drupal devel list). I tried it a bit but found it too heavy. I remember having tried kdevelop 3, a few years ago, but it was not stable then and back then I was not yet committed to any serious C++ project. I think I'll follow your advice and give kdevelop 4 another try as soon as I am more familiar with the basics of C++ programming. I am a fan of KDE in general (using Kubuntu), so kdevelop should be a natural choice, now. Thanks again for your most useful pointers. Blessings, Augustin. -- Friends: http://www.reuniting.info/ http://activistsolutions.org/ My projects: http://astralcity.org/ http://3enjeux.overshoot.tv/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://www.wechange.org/ http://searching911.info/ . |