[odb-users] Visual Studio 2017 - LNK1104 cannot open file 'odb-mysql-d.lib' for Hello World

Allan Head aheadsoftwaredeveloper at gmail.com
Fri May 3 19:33:44 EDT 2019


Boris, adding LIBODB_SHARED to the Preprocessor Definitions in the VC
Project worked.  Thanks for the help! ~Allan

Here is a recap of the steps taken to get the Hello Example from 2.4.0 to
work using ODB 2.5.0-b.13 and MS Visual Studio 2017:

Step 1:  Replace odb-mysql-d.lib and odb-d.lib in the VC project file.

1.1  Click on *Project* *| Properties* from the VS menu bar.
1.2  In the *Property Pages* under *Configuration Properties*, click on
*Linker* and then *Input*. Select *Additional Dependencies* in the right
pane and then:

1.2.1.  Replace odb-mysql-d.lib with odb-mysql.dll.lib.
1.2.2.  Replace odb-d.lib with odb.dll.lib

Step 2:  Add LIBODB_SHARED to the Preprocessor Definitions.

2.1  Repeat Step 1.1 above.
2.2  In the *Property Pages* under *Configuration Properties*, click on
*C/C++* and then *Preprocessor*.  Select *Preprocessor Definitions* in the
right pane, click on the down arrow, select *edit* and then:

2.2.1  Add LIBODB_SHARED to the bottom of the list.

Step 3:  Add odb\debug\bin to PATH.

3.1  Open x64 Native Tools Command Prompt for VS 2017
3.2  At the prompt enter: set "PATH=C:\odb\debug\bin;%PATH%"
3.2  Enter the following to run the Hello application:
driver.exe --user <user name> --password <password> --database odb_test

where <user name> is your database user name and <password> is your
database password.


3.3  If successful, you should see the following printed on the Command
Prompt screen:

Hello, John Doe!
Hello, Jane Doe!

count  : 3
min age: 31
max age: 33

On Fri, May 3, 2019 at 7:46 AM Boris Kolpackov <boris at codesynthesis.com>
wrote:

> Allan Head <aheadsoftwaredeveloper at gmail.com> writes:
>
> > Replacing odb.lib with odb.dll.lib generates the following error message
> > when performing a build:
> >
> > driver.obj : error LNK2001: unresolved external symbol "struct
> > odb::details::share odb::details::shared" (?shared at details@odb@
> @3Ushare at 12@A)
> > person-odb.obj : error LNK2001: unresolved external symbol "struct
> > odb::details::share odb::details::shared" (?shared at details@odb@
> @3Ushare at 12@A)
>
> Hm, strange. Can you add LIBODB_SHARED to PreprocessorDefinitions in
> your VC project, rebuild, and see if that helps?
>


More information about the odb-users mailing list