C ++新手:链接时遇到各种问题 [英] C++ Newbie: Having all sorts of problems linking

查看:133
本文介绍了C ++新手:链接时遇到各种问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2008中,tessdll遇到了几个问题.仅供参考,我将此应用程序创建为MFC应用程序,这样做只是为了利用我所需的简单GUI.只是纯C ++和Win32.

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.

由于某种原因,它可以作为调试版本正常运行(因为我已经包含了所需的头文件和lib文件,并且dll驻留在我可以放置的每个目录中……).

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 

此外,可以在下面找到tessdll.h的源以供参考: http://code.google. com/p/tesseract-ocr/source/browse/trunk/tessdll.h?r = 165

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

更多细节:

    我从工具栏调试并使用 集成调试器.
  • 我使用批处理 进行构建以创建发行版本.
  • I debug by from the toolbar and use the integrated debugger.
  • I use Batch Build to create the release version.

推荐答案

在没有看到项目设置的情况下,这很难. 要检查的内容(调试和发布设置之间的差异):

Without seeing the project settings, this is tough. Things to check (differences between debug and release settings):

1)您是否将.lib包含在发行版中?

1) Are you including the .lib in the release build?

2)您是否意外地为tessdll定义了预处理指令?

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.

仅在运行时需要DLL的存在.你还没走那么远.

The existence of the DLL is only required for run-time. You're not getting that far.

这篇关于C ++新手:链接时遇到各种问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆