Duplicate symbol: ODBC in ClaODB.dll

Good morning everyone,
I includes a class for MySQl that has a command line
PRAGMA (‘link (CLAODB.LIB)’),
in an application it gives a compilation error
Duplicate symbol: ODBC in ClaODB.dll, original file ODBPON.OBJ - C:\CodFonte\SQLCod_Pagtos\map\release\Pagtos.MAP:1
Duplicate symbol: ODBC_DrvReg in ClaODB.dll, original file ODBPON.OBJ - C:\CodFonte\SQLCod_Pagtos\map\release\Pagtos.MAP:2
In the templates I have acitve fm3, tagsuport and active LibCurl,
I don’t find anything in the .inc that is the same or similar to this PRAGMA.
Has anyone ever experienced this?

A linker error.

ON at the end of the name ODBPON means that “local mode” variant of the ODBC driver - CLAODBL.LIB - is involved into linking. I guess, the link mode in the Project Options set to “Lib” rather than to “Dll”. This setting instructs the Project Manager to include “local mode” variants of all distributed Clarion LIB files into the link list. If the “File Drivers” list in the Solution Explorer includes the ODBC driver, the CLAODBL.LIB files is including into the link list. The PRAGMA (‘link (CLAODB.LIB)’) directive in the program is adding the CLAODB.LIB file to the link list. So, both CLAODB.LIB and CLAODBL.LIB library files are involving into linking.

Do not use the PRAGMA directive to add driver libraries to the link list. Use the Solution Exporer for that.

The use of these types of PRAGMAs in code is pervasive in both the shipping Clarion libsrc code and various 3rd party addons. Perhaps the use of the %L% types of macros could mitigate the dupes.

image

Okay, I use CW 9…
in the Project Option the link was like Lib I didn’t change it… but anyway,
I removed the Mysql class from the After Global Includes, changed the Link to Dll, FM3 errors appeared, I included in Compiling:
FM3=>1;FM2=>1;PDLUDllMode=>0;PDLULinkMode=>1;ABCDllMode=>0;ABCLinkMode=>1,
and activated FM in Global Extension, and compiled, other errors appeared in nameapp.map
Unresolved External ds_FILEOPEN in ABERROR.obj
Unresolved External ds_FILEOPEN in ABFILE.obj
Unresolved External ds_FILEOPEN in CadastraEmpresa.obj
Unresolved External ds_FILEOPEN in ABFILE.obj
Unresolved External ds_FILEOPEN in ABFILE.obj
Unresolved External ds_FILEOPEN in CadastraEmpresa.obj
Unresolved External ds_FILEOPEN in CadastraEmpresa.obj
Unresolved External ds_FILEOPEN in ABWMFPAR.obj

In the directory are the Dlls.

Obs: apparently the problem is just that this app is linked as Lib and I didn’t know… ¬¬
I did a test with the Class with another app that is already Linked as DLL and it worked, so I changed the link to Lib and the Duplicate simbol error appeared, so I returned the test link to DLL and it worked again.

I need now for this stubborn with the Link to DLL…

You can use PRAGMA(link) directive to add drivers to the project/solution. But

  1. It’s better to do this in the project text or by using the Solution Explorer dialog
  2. If variant of library to be included to the project because of PRAGMA(link) directive mismatches the library which is already in the project, the link time errors are guaranteed.

NB that PRAGMA(link) directives in your message use meta-characters %V%, %X% and %L%. These meta-characters allow to link variant of library matching other project settings.