Raspberry Pi 3 ,fann_create_standard not defined
Raspberry Pi 3 ,fann_create_standard not defined
我最近通过Raspberry Pi的突触管理器下载了Fann(快速人工神经网络(库。我正在尝试运行默认应用程序,如下所示:
#include "fann.h"
#include "floatfann.h"
include "fann_data.h"
int main()
{
const unsigned int num_input = 2;
const unsigned int num_output = 1;
const unsigned int num_layers = 3;
const unsigned int num_neurons_hidden = 3;
const float desired_error = (const float) 0.001;
const unsigned int max_epochs = 500000;
const unsigned int epochs_between_reports = 1000;
struct fann *ann = fann_create_standard(num_layers, num_input,
num_neurons_hidden, num_output);
fann_set_activation_function_hidden(ann, FANN_SIGMOID_SYMMETRIC);
fann_set_activation_function_output(ann, FANN_SIGMOID_SYMMETRIC);
fann_train_on_file(ann, "xor.data", max_epochs,
epochs_between_reports, desired_error);
fann_save(ann, "xor_float.net");
fann_destroy(ann);
return 0;
}
我正在获取此输出:
enter code here
||=== Build: Debug in ArtificialNeuralNetworkExample (compiler: GNU GCC Compi ler) ===|
obj/Debug/main.o||In function `main':|
/home/pi/Documents/ArtificialNeuralNetworkExample/main.c|14|undefined reference to `fann_create_standard'|
/home/pi/Documents/ArtificialNeuralNetworkExample/main.c|17|undefined reference to `fann_set_activation_function_hidden'|
/home/pi/Documents/ArtificialNeuralNetworkExample/main.c|18|undefined reference to `fann_set_activation_function_output'|
/home/pi/Documents/ArtificialNeuralNetworkExample/main.c|20|undefined reference to `fann_train_on_file'|
/home/pi/Documents/ArtificialNeuralNetworkExample/main.c|23|undefined reference to `fann_save'|
/home/pi/Documents/ArtificialNeuralNetworkExample/main.c|25|undefined reference to `fann_destroy'|
||=== Build failed: 6 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
还尝试使用gcc
链接库如下:
gcc -lfann main.c
不确定该怎么做。
我相信,您需要更改库出现在编译语句中的顺序。
gcc -lfann main.c
应该是
gcc main.c -lfann
main.c
中使用的功能存在于libfann.so
中。
引用在线GCC手册,
-l library
[....]在命令中您编写此选项的情况下,它会有所不同;链接器按照指定的顺序搜索和处理库和对象文件。因此,
foo.o -lz bar.o
在文件foo.o
之后但在bar.o
之前搜索库z
。如果bar.o
是指z
中的功能,则可能不会加载这些功能。
在您的情况下,您面临着类似的情况,对于您的情况,库应在main.c
之后出现,因为库中的功能在main.c
相关文章:
- Using C++ CryptAPI:CNG Create CSR
- 错误:(-210:不支持的格式或格式组合)功能'create'中的硬件视频解码器不支持视频源
- Firebase C++VS2018 SDL2-在Firebase::app::create(..)上执行异常处理
- 我需要安装什么才能获得在Windows Server 2012 R2 Standard上运行C++hello world
- QThread::create 似乎没有将参数传递给函数
- 为什么"non-standard syntax; use '&' to create a pointer to member"在 CTOR 中使用线程?
- QThread::create running on UI Thread
- 函数参数中的向量"Non-standard syntax"错误
- 什么是"Reading unbounded stream from standard input (Memory Management)"的例子
- C++ standard: ODR and constexpr std::string_view
- 空指针(为缺少的输出数组调用的 create() 在 create,文件 /home/m/OpenCV/modules/
- 使用宏替换工厂模式样式 API 中的"create()"函数
- 错误:'create'不是 'cv::Tracker' 的成员
- Gtk::Main 和 Gtk::Application::create 有什么区别?
- 如果它被定义为 C++ 类中的成员函数,我得到了"non-standard syntax; use '&' to create a pointer to member"
- Visual Studio 2015:获取"non standard syntax, use '&' to create a pointer to member"错误
- Visual Studio 2015 "non-standard syntax; use '&' to create pointer for member"
- 了解重载运算符。收到"non-standard syntax; use '&' to create a pointer to a member"错误
- Visual Studio 2015 "non-standard syntax; use '&' to create a pointer to member"
- Visual Studio 2015 中的"non-standard syntax; use '&' to create a pointer to member"错误