Programs built with Visual Studio 2010 can link with the static binary libraries supplied in the liblept Visual Studio 2008 pre-built binaries for Windows archive.
You can also link with the dynamic binary libraries as long as you follow these rules:
Any memory allocated by liblept has be be freed with the new lept_free() function. For example, this includes the strings returned by getLeptonicaVersion(), getImagelibVersions(), and genTempFilename(), and the data created by pixWriteMemTiff().
Any file handles required by liblept have to be created by the new lept_fopen() function and closed with the new lept_fclose() function.
Failure to follow these rules will result in a crash due to the simultaneous use of two incompatible C Runtime DLLs (msvcr90.dll and msvcr100.dll). See Using Visual Studio 2010, how can one link to a DLL generated by Visual Studio 2008 for the gory details.
When converting the VS2008 Solution, you’ll get a number of warnings like the following in the Conversion Report:
MSB8012: $(TargetName) ('liblept168') does not match the Librarian's OutputFile property value 'LIB Debug\liblept168-static-mtdll-debug.lib' ('liblept168-static-mtdll-debug') in project configuration 'LIB Debug|Win32'. This may cause your project to build incorrectly. To correct this, please make sure that $(TargetName) property value matches the value specified in %(Lib.OutputFile).
Fix the liblept168 project by doing the following:
Right-click on liblept168 and choose Properties.
Then change liblept168 Property Pages | General | Target Name to one of the following values:
For the LIB Debug Configuration:
For the LIB Release Configuration:
For the DLL Debug Configuration:
The ioformats_reg project also needs to be fixed:
Right-click on ioformats_reg and choose Properties.
From the Configuration dropdown menu choose All Configurations.
Change ioformats_reg Property Pages | Linker | General | Output File to:
You still need to follow the instructions at create a new Visual Studio Project.
Exit and restart Visual Studio (or close and reopen the liblept solution).
To use the “Create Leptonica prog Project AddIn” follow the instructions for Visual Studio 2008 but copy vs2008\CreateLeptonicaProgProjects.AddIn and vs2008\CreateLPP.dll to your Visual Studio 2010 Addins folder (normally C:\My Documents\Visual Studio 2010\Addins).
Edit CreateLeptonicaProgProjects.AddIn and change:
The building of the image libraries has not been tested using Visual Studio 2010. Given the problems encountered while building liblept you can probably expect to have some issues.