简体   繁体   English

尝试在 VS2015 中包含仅 header 库 (tiny-dnn) 时出现编译错误

[英]Compilation errors when trying to include a header only library (tiny-dnn) in VS2015

Apologies for the images of text.为文本图像道歉。 I don't have access to the originals.我无法访问原件。

I am running VS2015 on MS10.我在 MS10 上运行 VS2015。 I am trying to implement the sample code from the docs: https://tiny-dnn.readthedocs.io/en/latest/getting_started/Getting-started.html我正在尝试从文档中实现示例代码: https://tiny-dnn.readthedocs.io/en/latest/getting_started/Getting-started.html

The following code does not compile:以下代码无法编译:

#include "stdafx.h"

#include <iostream>
#include "tiny_dnn/tiny_dnn.h"

using namespace tiny_dnn;
using namespace tiny_dnn::activation;
using namespace tiny_dnn::layers;

int main(){
    network<sequential> net;
    net << fully_connected_layer(2, 3) << sigmoid_layer()
        << fully_connected_layer(3, 1) << sigmoid_layer();
    return 0;
}

I get the following errors:我收到以下错误:

图片

I added the root folder to my includes:我将根文件夹添加到我的包含:

在此处输入图像描述 在此处输入图像描述

It looks like many identifiers are missing:看起来缺少许多标识符:

在此处输入图像描述

Also, I had the following compilation error until I forced it to go away with the define.另外,我有以下编译错误,直到我用定义将它强制为 go。 Might be related:可能相关:

在此处输入图像描述

What am I doing wrong?我究竟做错了什么?

I know it might be too late after 3 years,but i hop it would be useful, it seems that your code has an issue related to _SCL_SECURE_NO_WARNINGS which might be caused by Calling any of the potentially unsafe methods in the C++ Standard Library that results in Compiler Warning (level 3), that is probably caused by something used in tiny-dnn library.我知道 3 年后可能为时已晚,但我希望它会有用,您的代码似乎有一个与_SCL_SECURE_NO_WARNINGS相关的问题,这可能是由于调用 C++ 标准库中的任何潜在不安全方法导致的编译器警告(级别 3),这可能是由 tiny-dnn 库中使用的某些东西引起的。 To disable this warning, define the directive _SCL_SECURE_NO_WARNINGS in your code before any header include or If you use precompiled headers, put this directive in your precompiled header file before other includes.要禁用此警告,请在代码中的任何 header 包含之前定义指令_SCL_SECURE_NO_WARNINGS ,或者如果您使用预编译标头,请将此指令放入预编译的 header 文件中,然后再其他包含。

#define _SCL_SECURE_NO_WARNINGS
#include <iostream>
#include "tiny_dnn/tiny_dnn.h"

using namespace tiny_dnn;
using namespace tiny_dnn::activation;
using namespace tiny_dnn::layers;

int main(){
    network<sequential> net;
    net << fully_connected_layer(2, 3) << sigmoid_layer()
        << fully_connected_layer(3, 1) << sigmoid_layer();
    return 0;
}

another thing to notice tiny-dnn is designed with the -std=c++14 standard if your using tiny-dnn with newer standard like -std=c++17 you might also get some warnings that might be threated as errors considering your compiler options then you have to define the corresponding directive, for instance #define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS for c++17另一件需要注意的事情是 tiny-dnn 是用 -std=c++14 标准设计的,如果你使用 tiny-dnn 和更新的标准,比如 -std=c++17 你可能还会收到一些警告,考虑到你的错误,这些警告可能会被威胁为错误编译器选项然后你必须定义相应的指令,例如#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS for c++17

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 tiny-dnn用于行人识别时出错 - Error with tiny-dnn for pedestrian recognition VS2015中的一个编译问题 - A compilation problems in VS2015 VS2015其他包含目录找不到包含的标头? - VS2015 Additional Include Directories not finding included header? 如何在VS2015项目中包含libcds? - How to include libcds in VS2015 project? VS2015 C++ 错误地删除了 VC++ 目录属性页中的“包含目录”和“库目录” - VS2015 C++ Mistakenly erased "Include Directories" and "Library Directories" in VC++ Directories Property Page 尝试建立简单的HTTP侦听器时VS2015中的casablanca出现链接器错误 - Linker Errors with casablanca in VS2015 while trying to build a simple HTTP listener Constexpr因子编译结果在VS2015和GCC 5.4.0中 - Constexpr Factorial Compilation Results in VS2015 and GCC 5.4.0 编写标题和源文件时出现VS2015编译时错误 - VS2015 Compile-time error when I write an header and a source file 尝试使用VS2015和addrinfoW返回唯一指针时出现堆栈溢出 - Stack overflow when trying to return a unique pointer with VS2015 and addrinfoW 运行cl.exe时,VS2015的多处理器编译产生“没有足够的配额来处理此命令” - Multi processor compilation of VS2015 produces “not enough quota is available to process this command” when running cl.exe
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM