Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 ProjectsVisual Studio 2008ProjectsMTGO SO BotMTGO SO Bot
ReleaseMTGO 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:

  • I debug by from the toolbar and use the integrated debugger.
  • I use Batch Build to create the release version.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
227 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...