windows下OpenNN的编译与使用

32 篇文章 1 订阅
25 篇文章 3 订阅

下载OpenNN

OpenNN是C++编写的神经网络库,从官网上下载后,使用VisualStudio打开可见如下项目树
在这里插入图片描述

其中项目opennn是用于生成静态链接库的,而其他所有项目都是案例。右键点击项目opennn,然后选择生成,VS将会自动编译出opennn.lib文件。新项目必须包含这个lib文件。

仅有lib文件是不够的,还需要一系列头文件来说明这个lib文件内部到底有什么函数。opennn的所有头文件(.h)都存放在./opennn目录下。

新建项目

(1)新建一个C++控制台项目
(2)在根目录新建lib文件夹,将opennn.lib文件复制到该文件夹中
(3)在根目录新建include文件夹,把opennn的所有头文件(.h)都复制到该文件夹中
(4)打开项目属性,设置包含目录,如下图
在这里插入图片描述
(5)设置链接的库文件,如下图
在这里插入图片描述
(6)项目的cpp文件中写入以下代码。这段代码来自./blank,意思是一个空的神经网络项目,不实现任何功能

//   OpenNN: Open Neural Networks Library
//   www.opennn.org
//
//   B L A N K   A P P L I C A T I O N
//
//   Artificial Intelligence Techniques SL
//   artelnics@artelnics.com

// System includes

#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <time.h>
#include <algorithm>
#include <chrono>
#include <stdint.h>
#include <limits.h>
#include <statistics.h>
#include <regex>

// Systems Complementaries

#include <cmath>
#include <cstdlib>
#include <ostream>


// OpenNN includes

#include "opennn.h"

using namespace OpenNN;
using namespace std;
using namespace chrono;



int main(void)
{
    try
    {
        cout << "OpenNN. Blank Application." << endl;

        return 0;
    }
    catch(exception& e)
    {
        cerr << e.what() << endl;

        return 1;
    }
}


// OpenNN: Open Neural Networks Library.
// Copyright(C) 2005-2020 Artificial Intelligence Techniques, SL.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

(7)编译运行之后显示

OpenNN. Blank Application.

说明opennn已经可以正常运行

最后,我把lib文件夹和include文件夹整理如下,如有需要即可下载:
https://download.csdn.net/download/weixin_43325228/86246277

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

jedi-knight

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值