[英]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.