Code::Blocks Forums
Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Hirogens on July 20, 2011, 12:48:15 am
-
Hi,
How to integrate MySQL (libmysql.a or libmysqlclient.a" to "CODE::BLOCK, CYGWIN" ?
all my test don't work....
B.Regards
Hirogens
-
your going to have to be a bit more specific. What is your OS, C::B version and most importantly what is the actual error your getting.
-
Scuse me,
OS : Seven
C::B version 10.05
CYGWIN (no MINWG)
I have find the library and Include of mysql on http://devpaks.org/
For me MySql 5.0.5
And I have some link error,
undefined reference to `_mysql_init'
undefined reference to `_mysql_real_connect'
undefined reference to `_mysql_error'
libmysql.a is in link line
g++-4.exe --enable-libgomp -lncurses -o Serveur.exe obj/Debug/main.o obj/Debug/Console.o -lgomp C:/cygwin/lib/libform.a C:/cygwin/lib/libmenu.a C:/cygwin/lib/libpanel.a C:/cygwin/lib/libncurses.a C:/cygwin/lib/mysql/libmysql.a -lmysql
B.Regards
-
not related to C::B so expect this thread to be locked.
just a warning.
and in regards to mysql it is sometimes hard to get to work with mingw/cygwin (not impossible though) my guess is that the import library is broken.
put this in a bat file
call it reimp.bat
@echo off
for %%A in ("%1") do pexports %%A > tmp.def
for %%A in ("%1") do dlltool --dllname %%A --def tmp.def --output-lib lib%%A.a
make sure you have pexports.exe from mingw now run it in a windows prompt in the directory where libmysql.dll is like this reimp libmysql.dll
now you have a libmysql.a in the same dir move it to mingw/lib and try compiling again.
ofc remove the old import library and make sure you actually link against your new one.
-
You get pretty much the standard answer: read the FAQ :)
This one: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
And this one: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F
hint: look in the GCC's manual, what -l and -L does...
-
not related to C::B so expect this thread to be locked.
just a warning.
and in regards to mysql it is sometimes hard to get to work with mingw/cygwin (not impossible though) my guess is that the import library is broken.
put this in a bat file
call it reimp.bat
@echo off
for %%A in ("%1") do pexports %%A > tmp.def
for %%A in ("%1") do dlltool --dllname %%A --def tmp.def --output-lib lib%%A.a
make sure you have pexports.exe from mingw now run it in a windows prompt in the directory where libmysql.dll is like this reimp libmysql.dll
now you have a libmysql.a in the same dir move it to mingw/lib and try compiling again.
ofc remove the old import library and make sure you actually link against your new one.
Thank you very much, Work perfectly
B.Regards
Hirogens
-
You get pretty much the standard answer: read the FAQ Smile
This one: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
And this one: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F
hint: look in the GCC's manual, what -l and -L does...
I have read that, but I don't use MinGW, only CYGWIN.
My code must be 100% compatible with linux.
And I use C::B because I don't want developp by remote on my linux server.
B.Regards.
-
Hm, why do you think I've said something about MinGW?
The tips I've gave you apply for all compilers out there...
-
Yes sorry,
But i'm found many help topic on C::B/MinGW but not many on C::B/Cygwin .. :cry:
I have nothing against MinGW, but not quite compatible.
and of course, your help was on all compilers
B.Regards
Hirogens
-
np m8 :)
its pretty general stuff so obfuscated is right to making an import library for gcc using mingw tools will work just as well for cygwin since both use gcc :)
i use it all the time to get import libraries from stuff i cannot build on mingw like apache.