Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29273 Discussions

VS2008 using mysql.f90 and trying to link libmysql.lib to a Fortran program

Matthias_H_2
Beginner
3,137 Views

Hi all,

I am having a problem linking the libmysql.lib and mysqlclient.lib to my Fortran project. I am using the mysql.f90 by Daniel Kraft. I am further using the Intel 11.1 Fortran compiler in VS2008. The errors I am getting are all of this sort:

error LNK2019: unresolved external symbol _mysql_init referenced in function _MYFORTRAN_BINDING_mp_MYFORTRAN_CONNECT

It seems to be missing mysql_init, mysql_close, mysql_real_connect, mysql_real_querry, and so on

I did check with the lib command the contents of the library libmysql.lib and they refer to the libmysql.dll. I did check their content and all the references I am missing are in there. From what I understand that should be fine as this dll is used when executing the program. However, for some reason, this does not work when linking.

I did add to the properties page of the project under Linker -> general the path to the libraries and under -> input the names of the two libraries. I checked if its looking for the libs through changing the name of one lib, and then VS complains that it cannot find the library its looking for. So it should be looking at those two libs, I think.

Any ideas how to fix this problem.

Some more infos, I am running Win7 enterprise (64Bit) but the compiler is using the IA32 stuff, so that should be 32 bit code. I downloaded the mysql libs from the mysql site.

Any idea what the problem could be?

Kind regards, Matthias

0 Kudos
22 Replies
Johannes_Rieke
New Contributor III
440 Views
Hi Matthias, good to hear that you have access to the MySQL-DBs know. :-) The "localhost" thing was not working for me too and I used, like you, the IP directly instead. This occured only if I was running the MySQL service and the "client"-Fortran program on the same machine/virtual machine. Access from a PC to a Server with "someservername" instead "localhost" is running fine. [fortran] MySQL_DB(1) = t0dummy(i2pos(1,1):i2pos(1,2))//C_NULL_CHAR ! servername MySQL_DB(2) = t0dummy(i2pos(2,1):i2pos(2,2))//C_NULL_CHAR ! user MySQL_DB(3) = t0dummy(i2pos(3,1):i2pos(3,2))//C_NULL_CHAR ! database name [/fortran] and [fortran] pwd = 'mypassword'//C_NULL_CHAR db = ''//C_NULL_CHAR MySQLConnect = myfortran_connect(MySQL_DB(1), MySQL_DB(2), pwd, db) [/fortran] to connect. I assume that is some network stuff but no MySQL problem... Good luck and kind regards, Johannes
0 Kudos
Steven_L_Intel1
Employee
439 Views
Matthias, in the example you posted that I replied to, you weren't using NUL-terminated strings. 'localhost' usually works since it is an alias for 127.0.0.1, but if you need the IP, then fine.
0 Kudos
Reply