Linker error LNK2001 with vc++6.0 and mysqlclient.lib

Linker error LNK2001 with vc++6.0 and mysqlclient.lib

am 02.03.2005 11:29:02 von treffehn

Hi,

I get these three link errors when I link with the static library. If I=
use
the DLL
libMySQL.lib, it works fine, but I have to use the static mysqlclient.l=
ib.
According to VC++ help the __imp__ before RegCloseKey@4 indicates, that=

my_init.obj has been compiled with the /MD compiler option for a dynami=
c
library.

The only workaround I found is, to include libmysql.lib as library to t=
he
linker
options.

To me this seems a strange sollution to use a dynamic library for stati=
c
linking.
In my opinion this is an error in mysqlclient.lib.

Is there a better solution to this problem?


I use MySQL 4.0.23 or 4.0.20. The error is the same in both versions.
Windows XP SP2
MSVC++6.0 SP6

thanks Thomas

The Linker Errors
mysqlclient.lib(my_init.obj) : error LNK2001: __imp__RegCloseKey@4
mysqlclient.lib(my_init.obj) : error LNK2001: __imp__RegEnumValueA@32
mysqlclient.lib(my_init.obj) : error LNK2001: __imp__RegOpenKeyExA@20


Compiler Settings:
CPP_PROJ=3D/nologo /Zp1 /MT /W3 /GX /O2 /Op
/D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "DOS" /D "PC" /D
VERMAJOR=3D4 /D VERMINOR=3D0
/D "MSC" /D _X86_=3D1 /D "WIRE" /Fr"$(INTDIR)\\" /Fo"$(INTDIR)\\"
/Fd"$(INTDIR)\\" /FD /TP /c

Linker Settings:
LINK32_FLAGS=3Dlibmysql.lib mysqlclient.lib
comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib shell32.lib ole32.lib uuid.lib oleaut32.lib wsock32.lib
/nologo /version:3.2 /subsystem:windows /incremental:no
/pdb:"$(OUTDIR)\pap.pdb"
/machine:I386 /nodefaultlib:"libc"
/libpath:"c:\programme\mysql\lib\opt"

mit freundlichen Grüßen

Thomas Treffehn

Hans Brochier GmbH & Co KG

Abteilung S2 - Informationswesen
Marthastraße 16
90482 Nürnberg

Fon: +49 0911-9543-355
Fax: +49 0911-9543-383
www.brochier.de=



--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org

RE: Linker error LNK2001 with vc++6.0 and mysqlclient.lib

am 03.03.2005 00:52:24 von armin.schoeffmann

Hello Thomas,
the stubs for the dynamic Regx functions reside in 'Advapi32.lib';
So I suggest to add 'advapi32.lib' to your LINK32_FLAGs.
Let me know, if you're successful. I've never managed sofar to link the =
static mysql-api-lib against my projects for a couple of other reasons.

Grüße,
Armin.

> -----Original Message-----
> From: treffehn@brochier.de [mailto:treffehn@brochier.de]=20
> Sent: Wednesday, March 02, 2005 11:29 AM
> To: win32@lists.mysql.com
> Subject: Linker error LNK2001 with vc++6.0 and mysqlclient.lib
>=20
>=20
>=20
>=20
>=20
> Hi,
>=20
> I get these three link errors when I link with the static=20
> library. If I use the DLL libMySQL.lib, it works fine, but I=20
> have to use the static mysqlclient.lib.
> According to VC++ help the __imp__ before RegCloseKey@4=20
> indicates, that my_init.obj has been compiled with the /MD=20
> compiler option for a dynamic library.
>=20
> The only workaround I found is, to include libmysql.lib as=20
> library to the linker options.
>=20
> To me this seems a strange sollution to use a dynamic library=20
> for static linking.
> In my opinion this is an error in mysqlclient.lib.
>=20
> Is there a better solution to this problem?
>=20
>=20
> I use MySQL 4.0.23 or 4.0.20. The error is the same in both versions.
> Windows XP SP2
> MSVC++6.0 SP6
>=20
> thanks Thomas
>=20
> The Linker Errors
> mysqlclient.lib(my_init.obj) : error LNK2001: __imp__RegCloseKey@4
> mysqlclient.lib(my_init.obj) : error LNK2001: __imp__RegEnumValueA@32
> mysqlclient.lib(my_init.obj) : error LNK2001: __imp__RegOpenKeyExA@20
>=20
>=20
> Compiler Settings:
> CPP_PROJ=3D/nologo /Zp1 /MT /W3 /GX /O2 /Op /D "NDEBUG" /D=20
> "WIN32" /D "_WINDOWS" /D "_MBCS" /D "DOS" /D "PC" /D
> VERMAJOR=3D4 /D VERMINOR=3D0
> /D "MSC" /D _X86_=3D1 /D "WIRE" /Fr"$(INTDIR)\\" /Fo"$(INTDIR)\\"
> /Fd"$(INTDIR)\\" /FD /TP /c
>=20
> Linker Settings:
> LINK32_FLAGS=3Dlibmysql.lib mysqlclient.lib comctl32.lib=20
> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib=20
> shell32.lib ole32.lib uuid.lib oleaut32.lib wsock32.lib=20
> /nologo /version:3.2 /subsystem:windows /incremental:no=20
> /pdb:"$(OUTDIR)\pap.pdb"
> /machine:I386 /nodefaultlib:"libc"
> /libpath:"c:\programme\mysql\lib\opt"
>=20
> mit freundlichen Grüßen
>=20
> Thomas Treffehn
>=20
> Hans Brochier GmbH & Co KG
>=20
> Abteilung S2 - Informationswesen
> Marthastraße 16
> 90482 Nürnberg
>=20
> Fon: +49 0911-9543-355
> Fax: +49 0911-9543-383
> www.brochier.de
>=20
>=20
> --
> MySQL Windows Mailing List
> For list archives: http://lists.mysql.com/win32
> To unsubscribe: =20
> http://lists.mysql.com/win32?unsub=3Darmin.schoeffmann@aegae on.de
>=20
>=20
>=20
>=20

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org

Antwort: RE: Linker error LNK2001 with vc++6.0 and mysqlclient.lib

am 03.03.2005 08:33:52 von treffehn

Hello Armin,

That worked.
Thanks a lot.

Grüße,
Thomas





|---------+------------------------------>
| | Armin Schöffmann |
| | | | aegaeon.de> |
| | |
| | 03.03.2005 00:52 |
|---------+------------------------------>
>----------------------------------------------------------- ---------=
-----------------------------------------------------------|
| =
|
| An: , =
|
| Kopie: =
|
| Thema: RE: Linker error LNK2001 with vc++6.0 and mysqlclie=
nt.lib |
>----------------------------------------------------------- ---------=
-----------------------------------------------------------|




Hello Thomas,
the stubs for the dynamic Regx functions reside in 'Advapi32.lib';
So I suggest to add 'advapi32.lib' to your LINK32_FLAGs.
Let me know, if you're successful. I've never managed sofar to link the=

static mysql-api-lib against my projects for a couple of other reasons.=


Grüße,
Armin.

> -----Original Message-----
> From: treffehn@brochier.de [mailto:treffehn@brochier.de]
> Sent: Wednesday, March 02, 2005 11:29 AM
> To: win32@lists.mysql.com
> Subject: Linker error LNK2001 with vc++6.0 and mysqlclient.lib
>
>
>
>
>
> Hi,
>
> I get these three link errors when I link with the static
> library. If I use the DLL libMySQL.lib, it works fine, but I
> have to use the static mysqlclient.lib.
> According to VC++ help the __imp__ before RegCloseKey@4
> indicates, that my_init.obj has been compiled with the /MD
> compiler option for a dynamic library.
>
> The only workaround I found is, to include libmysql.lib as
> library to the linker options.
>
> To me this seems a strange sollution to use a dynamic library
> for static linking.
> In my opinion this is an error in mysqlclient.lib.
>
> Is there a better solution to this problem?
>
>
> I use MySQL 4.0.23 or 4.0.20. The error is the same in both versions.=

> Windows XP SP2
> MSVC++6.0 SP6
>
> thanks Thomas
>
> The Linker Errors
> mysqlclient.lib(my_init.obj) : error LNK2001: __imp__RegCloseKey@4
> mysqlclient.lib(my_init.obj) : error LNK2001: __imp__RegEnumValueA@3=
2
> mysqlclient.lib(my_init.obj) : error LNK2001: __imp__RegOpenKeyExA@2=
0
>
>
> Compiler Settings:
> CPP_PROJ=3D/nologo /Zp1 /MT /W3 /GX /O2 /Op /D "NDEBUG" /D
> "WIN32" /D "_WINDOWS" /D "_MBCS" /D "DOS" /D "PC" /D
> VERMAJOR=3D4 /D VERMINOR=3D0
> /D "MSC" /D _X86_=3D1 /D "WIRE" /Fr"$(INTDIR)\\" /Fo"$(INTDIR)\\"
> /Fd"$(INTDIR)\\" /FD /TP /c
>
> Linker Settings:
> LINK32_FLAGS=3Dlibmysql.lib mysqlclient.lib comctl32.lib
> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
> shell32.lib ole32.lib uuid.lib oleaut32.lib wsock32.lib
> /nologo /version:3.2 /subsystem:windows /incremental:no
> /pdb:"$(OUTDIR)\pap.pdb"
> /machine:I386 /nodefaultlib:"libc"
> /libpath:"c:\programme\mysql\lib\opt"
>
> mit freundlichen Grüßen
>
> Thomas Treffehn
>
> Hans Brochier GmbH & Co KG
>
> Abteilung S2 - Informationswesen
> Marthastraße 16
> 90482 Nürnberg
>
> Fon: +49 0911-9543-355
> Fax: +49 0911-9543-383
> www.brochier.de
>
>
> --
> MySQL Windows Mailing List
> For list archives: http://lists.mysql.com/win32
> To unsubscribe:
> http://lists.mysql.com/win32?unsub=3Darmin.schoeffmann@aegae on.de
>
>
>
>

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dbrian@tek-tools=
..com

=



--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org