Failed to link mysql5.1.39\\bin\\libmySQL.dll

2019-09-06 12:43发布

问题:

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:

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.



回答2:

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 :)