C ++ Win32中的链接器错误 [英] Linker Error in C++ Win32

查看:92
本文介绍了C ++ Win32中的链接器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我制作了一个示例C ++ Win32控制台应用程序,然后添加了一个类CFileParser.

现在,我在CFileParser中添加了一个称为OpeningInstructions()的函数,该函数被声明为public.

现在我将FileParser.h包含在具有MAIN()函数的应用程序的主文件中,然后尝试调用该函数..........并出现如下所示的错误. />
由于某些原因,它无法检测到CFileParser内部的函数.

知道如何解决这个问题吗?

在此先感谢

Hello there

I made a sample C++ Win32 console application and then added a class CFileParser.

Now i add a function inside the CFileParser called OpeningInstructions() which is declared as public.

Now i include FileParser.h in the main file of the app having MAIN() function and then trying to call the function.............. and it gives an error as shown below.

Fro some reason it''s not able to detect the function inside the clas CFileParser.

Any idea how to resolve this?

Thanks in advance

error LNK2019: unresolved external symbol "public: void __thiscall CFileParser::OpeningInstructions(void)" (?OpeningInstructions@CFileParser@@QAEXXZ) referenced in function _wmain
1&gt;C:\SourceCode\CodeFileParser\CodeFileParser\Debug\CodeFileParser.exe : fatal error LNK1120: 1 unr</pre>esolved externals

推荐答案

添加了一个类CFileParser"表明您已经自己编写了代码,并以源代码的形式将其添加到了程序中.然后,可能只声明了 CFileParser::OpeningInstructions,却没有定义了.在某些* .cpp文件中添加带有"{}"功能主体块的定义,或者在* .h文件中内联该函数主体.

—SA
"Added a class CFileParser" suggests that you''ve written it''s code by yourself and added it to your program in the form of source code. Then it is possible that you only declared CFileParser::OpeningInstructions but not defined it. Add the definition with ''{}'' function body block in some *.cpp file, or, alternatively, inline the function body in your *.h file.

—SA


这篇关于C ++ Win32中的链接器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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