【发布时间】:2016-07-15 17:31:43
【问题描述】:
我是第一次使用 CImg 库,但我在一个仅包含 CImg.h 的简单测试程序中遇到了编译错误。这是为什么?我该如何解决这个问题?
程序代码:
#include "../headers/CImg.h"
using namespace cimg_library;
int main()
{
return 0;
}
编译错误:
In function 'FILE* cimg_library::cimg::fopen(const char*, const char*)':
5065|error: '_fileno' was not declared in this scope
In function 'int cimg_library::cimg::fseek(FILE*, INT_PTR, int)':
5093|error: '_fseeki64' was not declared in this scope
In function 'INT_PTR cimg_library::cimg::ftell(FILE*)':
5102|error: '_ftelli64' was not declared in this scope
这是在装有 64 位 Windows 8.1 的 PC 上完成的。
命令:
g++.exe -Wall -fexceptions -g -std=c++11 -c "D:\informatics\Projects\image experiments\Rectangle to circle stretcher\sources\main.cpp" -o obj\Debug\sources\main.o
我在没有 -std=c++11 部分的情况下尝试了这个,但我得到了 2 个错误而不是 3 个。我没有得到 5065|error: '_fileno' was not declared in this scope。如果我将其替换为 -std=gnu++11
我还在运行 64 位版本的 Windows 7 的笔记本电脑上进行了尝试,并且在那里发生了同样的情况。
到目前为止,我已经解决了第一个错误,但没有解决其他两个错误。
【问题讨论】:
-
你是如何编译它的——你的命令是什么?你在哪个平台上?
-
@Mark Setchell 已编辑。
-
尝试将
#include <stdio.h>添加为您的第一行。 -
不,没用。
-
我不使用 Windows,所以我只是猜测使用 cmets 而不是回答,但也许我们会以这种方式到达那里。尝试添加
#include <cstdio>作为您的第一行。尝试将部分或全部添加到您的编译命令-Dcimg_display=0的开头附近,和/或-lgdi32在结尾处。
标签: c++ compilation compiler-errors cimg