Author Topic: trying to link a library, but where is it specified?  (Read 6879 times)

Offline Hans Henrik

  • Multiple posting newcomer
  • *
  • Posts: 23
trying to link a library, but where is it specified?
« on: May 17, 2010, 10:55:27 am »
when i compiled this in "Unix QuickCompile", it ends in
Quote
Linking console executable: ../otserv
/usr/bin/ld: cannot find -lmysql
but i can't figure out where i specify "mysql" (in Unix*. i got 1 in the windows builds), what am i missing? help please

http://www.mediafire.com/?kzo2242225m
« Last Edit: May 17, 2010, 10:57:56 am by Hans Henrik »

Offline kencamargo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: trying to link a library, but where is it specified?
« Reply #1 on: May 17, 2010, 02:00:41 pm »
when i compiled this in "Unix QuickCompile", it ends in
Quote
Linking console executable: ../otserv
/usr/bin/ld: cannot find -lmysql
but i can't figure out where i specify "mysql" (in Unix*. i got 1 in the windows builds), what am i missing? help please

http://www.mediafire.com/?kzo2242225m

Find in your setup where libmysql.a is, and set that directory in the corresponding section (linker) of the "set search directories" tab.

If you don't have that installed, you'll have to find out how to install the dev libraries for mySQL; this is distro-specific, and you didn't inform which is yours.

HTH,
Ken

Offline Hans Henrik

  • Multiple posting newcomer
  • *
  • Posts: 23
Re: trying to link a library, but where is it specified?
« Reply #2 on: May 17, 2010, 03:20:39 pm »
Ubuntu 10.04 Lucid Lynx
(i guess its abit off-topic, but please tell what you suggest to install)


but still, as far as i can see, i never ask it to link "mysql", i ask it to link to "mysqlclient" and "libmysql"
 :?:
Quote
g++  -o ../otserv .objs/account.o .objs/actions.o .objs/allocator.o .objs/ban.o .objs/baseevents.o .objs/beds.o .objs/chat.o .objs/combat.o .objs/commands.o .objs/condition.o .objs/configmanager.o .objs/connection.o .objs/container.o .objs/creature.o .objs/creatureevent.o .objs/cylinder.o .objs/database.o .objs/databaseodbc.o .objs/databasepgsql.o .objs/databasesqlite.o .objs/depot.o .objs/exception.o .objs/fileloader.o .objs/game.o .objs/house.o .objs/housetile.o .objs/ioaccount.o .objs/iomapotbm.o .objs/iomapserialize.o .objs/iomapxml.o .objs/ioplayer.o .objs/item.o .objs/items.o .objs/logger.o .objs/luascript.o .objs/mailbox.o .objs/map.o .objs/md5.o .objs/monster.o .objs/monsters.o .objs/movement.o .objs/networkmessage.o .objs/npc.o .objs/otserv.o .objs/outfit.o .objs/outputmessage.o .objs/party.o .objs/player.o .objs/position.o .objs/protocol.o .objs/protocollogin.o .objs/quests.o .objs/raids.o .objs/rsa.o .objs/scheduler.o .objs/scriptmanager.o .objs/server.o .objs/sha1.o .objs/spawn.o .objs/spells.o .objs/status.o .objs/talkaction.o .objs/tasks.o .objs/teleport.o .objs/thing.o .objs/tile.o .objs/tools.o .objs/trashholder.o .objs/vocation.o .objs/waitlist.o .objs/weapons.o    -lboost_regex -lgmp -lboost_system -lmysql -lboost_thread -lmysqlclient -lxml2 -llua5.1
i never tell it to call g++ with -lmysql (as far as i can see) also (noticed just now) im telling it to call g++ with "-lmysqlclient" and "-llibmysql", somehow it ignores "-llibmysql"

im confused  :(
« Last Edit: May 17, 2010, 03:27:04 pm by Hans Henrik »

Offline kencamargo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: trying to link a library, but where is it specified?
« Reply #3 on: May 17, 2010, 11:10:31 pm »
Ubuntu 10.04 Lucid Lynx
(i guess its abit off-topic, but please tell what you suggest to install)

but still, as far as i can see, i never ask it to link "mysql", i ask it to link to "mysqlclient" and "libmysql"
 :?:
im confused  :(

This is in probably in violation of forum rules and if one of the moderators tries to hit anyone's knuckles with a ruler make sure they are yours. :)

When you pass the command -lmysql to gcc (or g++) it will look for a file called libmysql.a, that's it. I don't use mysql, but a quick search in synaptics showed a package called libmysql-dev, that's probably what you need.

As a general rule, most shared libraries will have a xxx-dev counterpart containing the files needed to build an app supporting them.

HTH,
Ken

Offline Hans Henrik

  • Multiple posting newcomer
  • *
  • Posts: 23
Re: trying to link a library, but where is it specified?
« Reply #4 on: May 17, 2010, 11:52:48 pm »
This is in probably in violation of forum rules and if one of the moderators tries to hit anyone's knuckles with a ruler make sure they are yours. :)
yeah.. know, sorry
Quote
When you pass the command -lmysql to gcc (or g++) it will look for a file called libmysql.a, that's it. I don't use mysql, but a quick search in synaptics showed a package called libmysql-dev, that's probably what you need.
problem is i never tell codeblocks to add -lmysql, it somehow automatically add -lmysql (or so it seems), also i have set it to add -llibmysql, witch it somehow ignores (or so it seems)