views:

213

answers:

3

When trying to link to mysql5.1.39\bin\libmySQL.dll, I get an error:

fatal error LNK1107: invalid or corrupt file: cannot read at 0x2D0

Anyone familiar with this?

+1  A: 

You have to link with a .lib or a .def. If you only have the DLL there are tools to create .lib/.def from the DLL. Depending on what compiler you use it might be there already.

But I would guess that mySQL already have the .lib for this in their package.

jpyllman
Why dll can't be used?
Mask
Because the linker does not understand the structure of the DLL to extract the information about the functions to link to.
jpyllman
Do you not have a lib filder together with that bin folder where the dll is??
jpyllman
No,there isn't.Is there a tool to convert?
Mask
Make sure you install it when installing MySQL. You'll have it right there, at the MySQL's folder. For me "libmysql.lib" is at C:\Program Files (x86)\MySQL\MySQL Server 5.0\lib\opt .
Poni
@Mask, Better to get a correct package of the MySQL connector with everything included.
jpyllman
A: 

grab your fresh and shiny mysql-connector-bundle from here. i would choose the .zip file. once unzipped you can find a current libmysql.dll and libmysql.lib in the "lib" folder.

the tool you are refering tool is your regular linker, part of your visual studio (supposing you are using visual studio). since you already show lack of understanding for whats going on with the linker and which part is involved when and what for, i would argue against trying to build the mysql.dll (a side effect is of that is a mysql.lib btw) yourself .. except you want to do that as an excercise to increase your knowledge :)

akira
A: 

i ve already included libmysql.lib but still m getting the following error "THIS APPLICATION HAS FAILED TO START BECAUSE LIBMYSQL.DLL WAS NOT FOUND> RE_INSTALLING THE APPLICATION MAY FIX THE PROBLEM" the file libmysql.dll is present in the lib folder of mysql

AJ