dbTalk Databases Forums  

Re: Not able to connect to Mysql now

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Re: Not able to connect to Mysql now in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
chandra shekar
 
Posts: n/a

Default Re: Not able to connect to Mysql now - 04-21-2005 , 02:29 PM






Hi,
I went through Makefile.simple and learnt to
compile a c++ program. I could succeed in overcoming
all mysql.h mysql++.h related errors, but now I am
getting another error for "-lmysqlpp" and
"-lmysqlclient" switches.

I thought of compiling util.cpp so that I could use it
with other examples. Here is the command I used:

$g++ -I/usr/local/include -I/usr/local/mysql/include
-o util util.cpp -lmysqlpp -lmysqlclient
ERROR:
usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status

I got the same error while compiling simple1.cpp. (
Here I linked util.o which was already available in
example directory) in the example directory.

Please Help Me.

Thanx
shekar
--- Warren Young <mysqlpp (AT) etr-usa (DOT) com> wrote:

Quote:
chandra shekar wrote:

You have asked me to look in to Makefile.simple to
know how to build c++ programs.I could not
understand
much from it.

If you refuse to learn Makefile syntax, you will not
go very far as a
programmer.


I learned the basics of using make(1) using free
documentation, before
the web as we know it even existed. The resources
freely available to
you today are vastly greater than what I had access
to when I started.
You have no excuse. Learn make.

Where can I get
sample c++ codes which uses Mysql++.

You mean besides the twelve example programs that
came with MySQL++?

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:

http://lists.mysql.com/plusplus?unsu...ahoo (DOT) com



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #2  
Old   
Warren Young
 
Posts: n/a

Default Re: Not able to connect to Mysql now - 04-21-2005 , 03:29 PM






chandra shekar wrote:

Quote:
usr/bin/ld: cannot find -lmysqlclient
That's the MySQL C API library. It is either not installed in a
directory that ld can find on its own, or it is not installed at all.
If the former, use the -L compiler switch to tell it where the library
is at.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
chandra shekar
 
Posts: n/a

Default Re: Not able to connect to Mysql now - 04-23-2005 , 01:18 PM



Hi

I tried using the -L switch but it is giving error as
shown below.

g++ -I/usr/local/include -I/usr/local/mysql/include
-L/usr/local/lib -o util util.cpp -lmysqlpp
-lmysqlclient


ERRORS:
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0x18):
In function `_start':
.../sysdeps/i386/elf/start.S:77: undefined reference to
`main'
/usr/local/lib/libmysqlpp.so: undefined reference to
`pthread_getspecific'
/usr/local/lib/libmysqlpp.so: undefined reference to
`pthread_key_delete'
/usr/local/lib/libmysqlpp.so: undefined reference to
`pthread_mutexattr_destroy'
/usr/local/lib/libmysqlpp.so: undefined reference to
`pthread_mutexattr_setkind_np'
/usr/local/lib/libmysqlpp.so: undefined reference to
`pthread_key_create'
/usr/local/lib/libmysqlpp.so: undefined reference to
`pthread_mutexattr_init'
/usr/local/lib/libmysqlpp.so: undefined reference to
`pthread_setspecific'
collect2: ld returned 1 exit status

I also used the option -L/usr/local/mysql/lib but for
the same error.

I have set LD_LIBRARY_PATH to /usr/local/lib in
..bash_profile.
I have updated /etc/ld.so.conf with above paths and
ran ldconfig.

The .o files under /examples are working fine, but I
am not able to compile seperatly.
I reconfigured mysql++ and repeated above steps but
for no use.

Please help..!!!

Thanx
shekar.


--- Warren Young <mysqlpp (AT) etr-usa (DOT) com> wrote:

Quote:
chandra shekar wrote:

usr/bin/ld: cannot find -lmysqlclient

That's the MySQL C API library. It is either not
installed in a
directory that ld can find on its own, or it is not
installed at all.
If the former, use the -L compiler switch to tell it
where the library
is at.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:

http://lists.mysql.com/plusplus?unsu...ahoo (DOT) com



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #4  
Old   
Warren Young
 
Posts: n/a

Default Re: Not able to connect to Mysql now - 04-25-2005 , 06:10 AM



Chris Frey wrote:
Quote:
thread library of your system as another -l option in the list.
You currently have -lmysqlpp and -lmysqlclient, you'll need
one for threading.
Also, you'd need to use libmysqlclient_r instead of the regular
non-thread-safe libmysqlclient.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #5  
Old   
chandra shekar
 
Posts: n/a

Default Re: Not able to connect to Mysql now - 04-25-2005 , 01:16 PM



Yessssssss!!!
Its working. I used -lpthread along with the below
option. Its working greate. I could compile
simple1.cpp and util.cpp together and performed the
transaction.
Thanx a lot to Warren Young and Cris Frey for
helping me out. I learnt a lot. ( espcially about
Makefile ..thanx Warren)

cheers )
shekar

--- Chris Frey <cdfrey (AT) netdirect (DOT) ca> wrote:

Quote:
If you look at the error messages, it says it is
trying to link 'main',
and that it is looking for thread specific functions
that 'libmysqlpp.so'
is relying on.

This means:
- it is trying to create the final binary of your
program.
This is impossible since you are only compiling
util.cpp,
which has no main() in it. What you are probably
trying to
do is just compile util.cpp to util.o (object
file) so you
can then later link a bunch of .o files together
into your
final program. Look at the gcc man page to find
the proper
command line switch to compile only, and not link
yet.

Take a look inside util.cpp, and note there is no
main().

- it is trying to find thread stuff, so that means
you have compiled
mysql++ with thread support turned on. If this is
not what
you expected, recompile and reinstall mysql++ with
the proper
options to the configure script.

If it is what you expect, then you need to add the
appropriate
thread library of your system as another -l option
in the list.
You currently have -lmysqlpp and -lmysqlclient,
you'll need
one for threading.

- Chris


On Sat, Apr 23, 2005 at 11:18:08AM -0700, chandra
shekar wrote:
Hi

I tried using the -L switch but it is giving error
as
shown below.

g++ -I/usr/local/include
-I/usr/local/mysql/include
-L/usr/local/lib -o util util.cpp -lmysqlpp
-lmysqlclient


ERRORS:


/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0x18):
In function `_start':
../sysdeps/i386/elf/start.S:77: undefined
reference to
`main'
/usr/local/lib/libmysqlpp.so: undefined reference
to
`pthread_getspecific'
/usr/local/lib/libmysqlpp.so: undefined reference
to
`pthread_key_delete'
/usr/local/lib/libmysqlpp.so: undefined reference
to
`pthread_mutexattr_destroy'
/usr/local/lib/libmysqlpp.so: undefined reference
to
`pthread_mutexattr_setkind_np'
/usr/local/lib/libmysqlpp.so: undefined reference
to
`pthread_key_create'
/usr/local/lib/libmysqlpp.so: undefined reference
to
`pthread_mutexattr_init'
/usr/local/lib/libmysqlpp.so: undefined reference
to
`pthread_setspecific'
collect2: ld returned 1 exit status

I also used the option -L/usr/local/mysql/lib but
for
the same error.

I have set LD_LIBRARY_PATH to /usr/local/lib in
.bash_profile.
I have updated /etc/ld.so.conf with above paths
and
ran ldconfig.

The .o files under /examples are working fine, but
I
am not able to compile seperatly.
I reconfigured mysql++ and repeated above steps
but
for no use.

Please help..!!!

Thanx
shekar.


--- Warren Young <mysqlpp (AT) etr-usa (DOT) com> wrote:

chandra shekar wrote:

usr/bin/ld: cannot find -lmysqlclient

That's the MySQL C API library. It is either
not
installed in a
directory that ld can find on its own, or it is
not
installed at all.
If the former, use the -L compiler switch to
tell it
where the library
is at.

--
MySQL++ Mailing List
For list archives:
http://lists.mysql.com/plusplus
To unsubscribe:



http://lists.mysql.com/plusplus?unsu...ahoo (DOT) com




__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:

http://lists.mysql.com/plusplus?unsu...irect (DOT) ca

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:

http://lists.mysql.com/plusplus?unsu...ahoo (DOT) com



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.