Reputation: 25912
I am having several problems with tessdll in Visual Studio 2008. FYI, I created this app as an MFC application, I did this just to take advantage of the simple GUI I needed. It is just straight C++ and win32 from there on out.
This builds fine as a debug release for some reason (as I have included the header files and lib files that I need, and dll resides in every directory I could put it......).
So, there is a linking problem during building a release version:
Linking...
MTGOBot.obj : error LNK2001: unresolved external symbol "__declspec
(dllimport) public: __thiscall TessDllAPI::TessDllAPI(char const
*)" (__imp_??0TessDllAPI@@QAE@PBD@Z)
MTGOBot.obj : error LNK2001: unresolved external symbol "__declspec
(dllimport) public: __thiscall TessDllAPI::~TessDllAPI(void)" (__imp_??
1TessDllAPI@@QAE@XZ)
MTGOBot.obj : error LNK2001: unresolved external symbol "__declspec
(dllimport) public: int __thiscall TessDllAPI::BeginPage(unsigned
int,unsigned int,unsigned char *,unsigned char)" (__imp_?
BeginPage@TessDllAPI@@QAEHIIPAEE@Z)
MTGOBot.obj : error LNK2001: unresolved external symbol "__declspec
(dllimport) public: struct ETEXT_STRUCT * __thiscall
TessDllAPI::Recognize_all_Words(void)" (__imp_?
Recognize_all_Words@TessDllAPI@@QAEPAUETEXT_STRUCT@@XZ)
C:\CPP Projects\Visual Studio 2008\Projects\MTGO SO Bot\MTGO SO Bot
\Release\MTGO SO Bot.exe : fatal error LNK1120: 4 unresolved externals
Also, for reference, the source to tessdll.h can be found here: http://code.google.com/p/tesseract-ocr/source/browse/trunk/tessdll.h?r=165
A few more details:
Upvotes: 0
Views: 714
Reputation: 4511
A first guess: You did not use the link-library for the DLL. The linker shouts about not finding some symbols, and TessDllAPI
sound very much like a DLL. By default (read: on Project Settings Dialog Startup) all your project settings are specific to the build-configuration (Debug, Release), but you can select "All Configurations" from the GUI. This would explain why it works in one configuration, but not in another.
Try a
#pragma comment(lib:"tessdll")
// (Of course you need to replace the `tessdll` with the name of the library.)
in the header-file, or add this library for linking in the "Release" configuration.
Upvotes: 2
Reputation: 456
Without seeing the project settings, this is tough. Things to check (differences between debug and release settings):
1) Are you including the .lib in the release build?
2) Did you accidentally define the preprocessor directive for tessdll?
I'd walk through the settings, switching back-and-forth between debug and release and see what was accidentally added/forgotten.
The existence of the DLL is only required for run-time. You're not getting that far.
Upvotes: 1