我如何在VC ++(MFC)中通过FANN实现神经网络 [英] How can i implement a neural network by FANN in VC++ (MFC)

查看:200
本文介绍了我如何在VC ++(MFC)中通过FANN实现神经网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经制作了libfann并将其附加到我的项目中
而且我已经编写了这些代码,但是由于编译,它给出了这3个链接器错误!为什么?



错误8错误LNK2019:在函数"public:void __thiscall CTTSPDlg :: OnBnClickedButton2(void)"中引用了未解析的外部符号__imp__fann_destroy @ 4(?OnBnClickedButton2 @ CTTSPDlg @@ QAEXXZ)TTS-PDlg.obj
-------
错误9错误LNK2019:在函数"public:void __thiscall CTTSPDlg :: OnBnClickedButton2(void)"中引用了未解析的外部符号__imp__fann_create_standard(?OnBnClickedButton2 @ CTTSPDlg @@ QAEXXZ)TTS-PDlg.obj
-------------
错误10致命错误LNK1120:2个未解决的外部组件D:\ TTS \ Programming \ Delete1 \ Debug \ TTS-P.exe
-------------

I have made libfann and attached it to my project
and also I''ve wrote these code, but due the compilation it gives these 3 linker errors! Why?



Error 8 error LNK2019: unresolved external symbol __imp__fann_destroy@4 referenced in function "public: void __thiscall CTTSPDlg::OnBnClickedButton2(void)" (?OnBnClickedButton2@CTTSPDlg@@QAEXXZ) TTS-PDlg.obj
-------
Error 9 error LNK2019: unresolved external symbol __imp__fann_create_standard referenced in function "public: void __thiscall CTTSPDlg::OnBnClickedButton2(void)" (?OnBnClickedButton2@CTTSPDlg@@QAEXXZ) TTS-PDlg.obj
-------------
Error 10 fatal error LNK1120: 2 unresolved externals D:\TTS\Programming\Delete1\Debug\TTS-P.exe
-------------

#include "floatfann.h"
.
.
.
{
    struct fann *ann = fann_create_standard(3,2,4,1);
    
    fann_destroy(ann);
}

推荐答案

您的链接器错误告诉您,链接器找不到与函数签名匹配的任何内容.

这可能是由于以下原因引起的:
0.忘记为链接器包含.lib文件
1.函数签名不匹配(搜索C ++函数修饰/信息修改),如果要保持简单,请通过使用外部"C"方法包装dll函数来避免代码修改.
Your linker errors are telling you that the linker can''t find anything that matches the function signatures.

This can be caused if:
0. Forgot to include your .lib file for the linker
1. The function signatures don''t match (search for C++ function decorations/mangling for information), if you want to keep it simple, avoid the mangling by wrapping your dll functions with the extern "C" method.


似乎您遇到了"C ++装饰名称"问题.

如果该库是用C编写的,而您的应用程序是用C ++编写的,那么您需要告诉编译器生成对库函数的C样式调用(和名称).

您需要将函数声明包装在.h文件中,如下所示:

It seems that you have the "C++ Decorated Name" problem.

If the library was written in C and your app is in C++, then you need to tell the compiler to generate C style calls (and names) to the library functions.

You need to wrap the function declarations in the .h file like this:

#ifdef _MSC_VER                         /* MicroSoft C++ compiles, declare externals as "C" calling standard */
#ifdef __cplusplus
extern "C" {
#endif
#endif

// place the declarations / function prototypes for fann_create_standard and fann_destroy here

#ifdef _MSC_VER
#ifdef __cplusplus
}
#endif
#endif


这篇关于我如何在VC ++(MFC)中通过FANN实现神经网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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