在Visual Studio 2005 C++编译器上,当我的代码使用fopen和此类调用时,我收到以下警告.
1>foo.cpp(5) : warning C4996: 'fopen' was declared deprecated
1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(234) : see declaration of 'fopen'
1> Message: 'This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
Run Code Online (Sandbox Code Playgroud)
我该如何防止这种情况?
带有Cygwin 1.7的GoogleTest 1.6:'fileno'未在此范围内声明
在Eclipse CDT中对Factorial()函数构建简单测试时出现错误消息:
Invoking: Cygwin C++ Compiler
g++ -std=c++0x -DGTEST_OS_CYGWIN=1 -I"E:\source\gtest-1.6.0\include" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/challenge.d" -MT"src/challenge.d" -o "src/challenge.o" "../src/challenge.cpp"
In file included from E:\source\gtest-1.6.0\include/gtest/internal/gtest-internal.h:40:0,
from E:\source\gtest-1.6.0\include/gtest/gtest.h:57,
from ../src/challenge.cpp:11:
E:\source\gtest-1.6.0\include/gtest/internal/gtest-port.h: In function 'int testing::internal::posix::FileNo(FILE*)':
E:\source\gtest-1.6.0\include/gtest/internal/gtest-port.h:1589:51: error: 'fileno' was not declared in this scope
E:\source\gtest-1.6.0\include/gtest/internal/gtest-port.h:1595:57: error: 'strdup' was not declared in this scope
E:\source\gtest-1.6.0\include/gtest/internal/gtest-port.h:1627:71: error: 'fdopen' was not declared in this scope
Run Code Online (Sandbox Code Playgroud)
Eclipse CDT 8.1在Cygwin 1.7.22上运行gcc 4.7.3
gTest 1.6成功构建,包括演示测试,在Cygwin 1.7.22上使用cmake 2.8.9
我已经将构建的lib与完整路径链接起来,E:\ lib\gtest-1.6.0\Cygwin\libgtest.a
手动添加了以下命令选项,没有它就得到了相同的错误.
-DGTEST_OS_CYGWIN=1
Run Code Online (Sandbox Code Playgroud)
似乎错误与我的代码无关.有人在Eclipse和Cygwin中使用gTest吗? …
我按照以下教程在Cygwin64中安装xgboost python包:
但是当在dmlc-core目录中执行make时,我收到以下错误:
harrison4@mypc ~/xgboost/dmlc-core
$ mingw32-make -j4
g++ -c -O3 -Wall -Wno-unknown-pragmas -Iinclude -std=c++0x -fPIC -DDMLC_USE_HDFS=0 -DDMLC_USE_S3=0 -DDMLC_USE_AZURE=0 -msse2 -o line_split.o src/io/line_split.cc
g++ -c -O3 -Wall -Wno-unknown-pragmas -Iinclude -std=c++0x -fPIC -DDMLC_USE_HDFS=0 -DDMLC_USE_S3=0 -DDMLC_USE_AZURE=0 -msse2 -o recordio_split.o src/io/recordio_split.cc
g++ -c -O3 -Wall -Wno-unknown-pragmas -Iinclude -std=c++0x -fPIC -DDMLC_USE_HDFS=0 -DDMLC_USE_S3=0 -DDMLC_USE_AZURE=0 -msse2 -o input_split_base.o src/io/input_split_base.cc
g++ -c -O3 -Wall -Wno-unknown-pragmas -Iinclude -std=c++0x -fPIC -DDMLC_USE_HDFS=0 -DDMLC_USE_S3=0 -DDMLC_USE_AZURE=0 -msse2 -o io.o src/io.cc
src/io/line_split.cc:1:0: aviso: se descarta -fPIC para el objetivo (todo el código …Run Code Online (Sandbox Code Playgroud) 我可以这样称呼我的程序:
1. ./main solved.txt
2. cat unsolved.txt | ./main
3. cat unsolved.txt | ./main solved.txt
Run Code Online (Sandbox Code Playgroud)
我正在使用它来知道我是否需要在C POSIX标准上从管道读取数据:
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <unistd.h>
int main( int argumentsCount, char* argumentsStringList[] )
{
std::stringstream inputedPipeLineString;
if( argumentsCount > 1 )
{
printf( "argumentsStringList[1]: %s", argumentsStringList[ 1 ] );
}
// If it is passed input through the terminal pipe line, get it.
if( !isatty( fileno( stdin ) ) )
{
// Converts the std::fstream "std::cin" to std::stringstream which …Run Code Online (Sandbox Code Playgroud) c++ ×2
cygwin ×2
c ×1
c++11 ×1
deprecated ×1
eclipse ×1
fopen ×1
gcc ×1
googletest ×1
posix ×1
python ×1
visual-c++ ×1
xgboost ×1