3

I'm working with MySql lib, when I'm compiling, although the compilation it's ok, I have this warning:

g++: -lmysqlclient: linker input file unused because linking not done

I'm using automake, and I had to add -lmysqlclient in configure.ac, so I guess that the linker gives me that warning in every file that the link is not necesary.

My question is, how can I hide that specific warning?

Thanks!

Anderson Pimentel
  • 5,086
  • 2
  • 32
  • 54
jjamardo
  • 267
  • 3
  • 9
  • http://stackoverflow.com/questions/487108/how-to-supress-specific-warnings-in-g – Ofiris Jan 21 '13 at 17:39
  • 3
    You seem to be using -lmysqlclient when you are compiling a file , it is only needed when you are linking, you should not add -lmysqlclient when compiling source files. Please show use the commands you're running when you are compiling and linking your program. – nos Jan 21 '13 at 17:40
  • This is the output when compiling, for every file: g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include -g -O2 -g -O0 -DDEBUG -pipe -Wall -D_REENTRANT -I/usr/include/libxml2 -lmysqlclient -MT Attr.lo -MD -MP -MF .deps/Attr.Tpo -c Attr.cxx -o Attr.o g++: -lmysqlclient: linker input file unused because linking not done g++: -lmysqlclient: linker input file unused because linking not done – jjamardo Jan 21 '13 at 18:12
  • 1
    `For example, the -c option says not to run the linker` says the man page – Déjà vu Jan 21 '13 at 18:20
  • @nos's comment (why a comment) is the correct answer. – Lightness Races in Orbit Jan 21 '13 at 18:45
  • I don understand, i want to run the linker. – jjamardo Jan 21 '13 at 18:45
  • Resolved! To add an ld option with automake, i need to add libsomething_la_LIBADD = -lmysqlclient Now like @nos said, I'm not adding -lmysqlclient in compilation. Thanks to all! – jjamardo Jan 21 '13 at 19:13
  • @user1997816, please post your resolution as an answer, and eventually accept it. That way, others can profit from your solution. – MvG Jan 21 '13 at 20:15

1 Answers1

0

Resolved! To add an LD option with automake, I need to add

libsomething_la_LIBADD=-lmysqlclient

into the Makefile.am.

Now like @nos said, I'm not adding -lmysqlclient in compilation. Thanks to all!

jjamardo
  • 267
  • 3
  • 9