Re: [Cppcms-users] linking libraries (Re: Starting with DbiXX
Brought to you by:
artyom-beilis
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. > > > |