Raised This Month: $ Target: $400
 0% 

MySQL help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sedmorph
Member
Join Date: Dec 2004
Old 06-26-2006 , 16:24   MySQL help
Reply With Quote #1

Hello,
I am making a plugin that requires MySQL functionality. I have tried a coupple of different methods, but the most common problem that i have is that, when i compile the plugin and run in debug mode, i get the error

'libmysql.dll not found' or something like that, then the game finishes loading but without my plugin.

Could someone please point me in the right direction, some example code would be a bonus () - also this plugin needs to work for w32 and linux

Thanks in advance.
__________________
=SeD=[V]orpheus
sedmorph is offline
slurpycof
Senior Member
Join Date: Nov 2004
Old 06-26-2006 , 23:55   Re: MySQL help
Reply With Quote #2

Make sure you have the sql modules installed and running first off. you can get examples from any approved mysql plugin. Here is one of mine you can look at source for.

http://forums.alliedmods.net/showthread.php?t=25847
slurpycof is offline
Knagg0
SourceMod Donor
Join Date: Dec 2005
Location: Germany
Old 06-27-2006 , 05:50   Re: MySQL help
Reply With Quote #3

AMX Mod X != Metamod: Source


Use mysqlclient.lib so you don't need the libmysql.dll.
Or copy the libmysql.dll to your srcds/bin dir...
Knagg0 is offline
slurpycof
Senior Member
Join Date: Nov 2004
Old 06-27-2006 , 07:00   Re: MySQL help
Reply With Quote #4

Quote:
Originally Posted by Knagg0
AMX Mod X != Metamod: Source


Use mysqlclient.lib so you don't need the libmysql.dll.
Or copy the libmysql.dll to your srcds/bin dir...

new forums got me, sorry. I was reading all posts since last visit. Guess i am going to have to start paying attention now.
slurpycof is offline
sedmorph
Member
Join Date: Dec 2004
Old 06-27-2006 , 09:22   Re: MySQL help
Reply With Quote #5

Quote:
Originally Posted by Knagg0
AMX Mod X != Metamod: Source


Use mysqlclient.lib so you don't need the libmysql.dll.
Or copy the libmysql.dll to your srcds/bin dir...

Thats the problem, i did include the lib file, but it still needed the dll. I cant copy the dll to my bin folder, because this will be a public plugin and no one else requires you to copy any dll files apart from the plugin itself :s
__________________
=SeD=[V]orpheus
sedmorph is offline
Knagg0
SourceMod Donor
Join Date: Dec 2005
Location: Germany
Old 06-27-2006 , 10:41   Re: MySQL help
Reply With Quote #6

What .lib file did you "include"?
You don't need the libmysql.dll if you use mysqlclient.lib...
I think you currently use libmysql.lib which needs the libmysql.dll.
So be sure that you use the mysqlclient.lib file ;)

Last edited by Knagg0; 06-27-2006 at 10:47.
Knagg0 is offline
sedmorph
Member
Join Date: Dec 2004
Old 06-27-2006 , 13:13   Re: MySQL help
Reply With Quote #7

Also, thats another problem. When i include the mysqlclient.lib (forgot to mention this in my first post) i get compile errors, like a function is already declared.

I'm not at my main pc at the moment, so i cant get an example, ill post an example in a few hours.

ps.. Thx for helping so far
__________________
=SeD=[V]orpheus
sedmorph is offline
Knagg0
SourceMod Donor
Join Date: Dec 2005
Location: Germany
Old 06-27-2006 , 13:50   Re: MySQL help
Reply With Quote #8

Try this for windows:

Code:
#pragma comment(linker, "/NODEFAULTLIB:libc.lib")
#pragma comment(lib, "mysqlclient.lib")
#pragma comment(lib, "wsock32.lib")
For linux use libmysqlclient.a instead of libmysqlclient.so ;)
Knagg0 is offline
sedmorph
Member
Join Date: Dec 2004
Old 06-27-2006 , 17:08   Re: MySQL help
Reply With Quote #9

Ok, this is what happens when i include mysqlclient.lib

Code:
Linking...
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
LIBCMTD.lib(_file.obj) : error LNK2005: ___iob_func already defined in LIBCD.lib(_file.obj)
LIBCMTD.lib(_file.obj) : error LNK2005: ___initstdio already defined in LIBCD.lib(_file.obj)
LIBCMTD.lib(_file.obj) : error LNK2005: ___endstdio already defined in LIBCD.lib(_file.obj)
LIBCMTD.lib(_file.obj) : error LNK2005: __cflush already defined in LIBCD.lib(_file.obj)
LIBCMTD.lib(_file.obj) : error LNK2005: __iob already defined in LIBCD.lib(_file.obj)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __alloc_osfhnd already defined in LIBCD.lib(osfinfo.obj)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __set_osfhnd already defined in LIBCD.lib(osfinfo.obj)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __free_osfhnd already defined in LIBCD.lib(osfinfo.obj)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __get_osfhandle already defined in LIBCD.lib(osfinfo.obj)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __open_osfhandle already defined in LIBCD.lib(osfinfo.obj)
LIBCMTD.lib(setlocal.obj) : error LNK2005: _setlocale already defined in LIBCD.lib(setlocal.obj)
LIBCMTD.lib(setlocal.obj) : error LNK2005: __expandlocale already defined in LIBCD.lib(setlocal.obj)
LIBCMTD.lib(setlocal.obj) : error LNK2005: ___init_dummy already defined in LIBCD.lib(setlocal.obj)
LIBCMTD.lib(setlocal.obj) : error LNK2005: __strcats already defined in LIBCD.lib(setlocal.obj)
LIBCMTD.lib(setlocal.obj) : error LNK2005: ___lc_strtolc already defined in LIBCD.lib(setlocal.obj)
LIBCMTD.lib(setlocal.obj) : error LNK2005: ___lc_lctostr already defined in LIBCD.lib(setlocal.obj)
LIBCMTD.lib(mbctype.obj) : error LNK2005: __setmbcp already defined in LIBCD.lib(mbctype.obj)
LIBCMTD.lib(mbctype.obj) : error LNK2005: __getmbcp already defined in LIBCD.lib(mbctype.obj)
LIBCMTD.lib(mbctype.obj) : error LNK2005: ___initmbctable already defined in LIBCD.lib(mbctype.obj)
LIBCMTD.lib(initctyp.obj) : error LNK2005: ___init_ctype already defined in LIBCD.lib(initctyp.obj)
LIBCMTD.lib(initctyp.obj) : error LNK2005: ____mb_cur_max_func already defined in LIBCD.lib(initctyp.obj)
LIBCMTD.lib(initctyp.obj) : error LNK2005: ____lc_codepage_func already defined in LIBCD.lib(initctyp.obj)
LIBCMTD.lib(initctyp.obj) : error LNK2005: ____lc_collate_cp_func already defined in LIBCD.lib(initctyp.obj)
LIBCMTD.lib(initctyp.obj) : error LNK2005: ____lc_handle_func already defined in LIBCD.lib(initctyp.obj)
LIBCMTD.lib(initnum.obj) : error LNK2005: ___init_numeric already defined in LIBCD.lib(initnum.obj)
LIBCMTD.lib(initnum.obj) : error LNK2005: ___free_lconv_num already defined in LIBCD.lib(initnum.obj)
LIBCMTD.lib(initmon.obj) : error LNK2005: ___init_monetary already defined in LIBCD.lib(initmon.obj)
LIBCMTD.lib(initmon.obj) : error LNK2005: ___free_lconv_mon already defined in LIBCD.lib(initmon.obj)
LIBCMTD.lib(initmon.obj) : error LNK2005: ___lconv_intl already defined in LIBCD.lib(initmon.obj)
LIBCMTD.lib(isctype.obj) : error LNK2005: __chvalidator already defined in LIBCD.lib(isctype.obj)
LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype already defined in LIBCD.lib(isctype.obj)
__________________
=SeD=[V]orpheus
sedmorph is offline
Knagg0
SourceMod Donor
Join Date: Dec 2005
Location: Germany
Old 06-27-2006 , 17:12   Re: MySQL help
Reply With Quote #10

Quote:
Originally Posted by Knagg0
Code:
#pragma comment(linker, "/NODEFAULTLIB:libc.lib")
#pragma comment(lib, "mysqlclient.lib")
#pragma comment(lib, "wsock32.lib")
Knagg0 is offline
Reply



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

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

Forum Jump


All times are GMT -4. The time now is 10:20.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode