我正在尝试使用 CImg 库,但我无法让它工作。我正在终端上使用mac,我写了一个hello world程序
#include "CImg.h"
using namespace cimg_library;
int main() {
const unsigned char purple[] = { 255,0,255 };
CImg<unsigned char>(640,400,1,3,0).draw_text("Hello World",100,100,purple).di\
splay("My first CImg code");
return 0;
}
这需要库的“draw_text”功能。我包含了标题并编译为
g++ -o hello_word.exe hello_world.cpp -O2 -L/usr/X11R6/lib -lm -lpthread -lX11 -I/opt/X11/include
我得到的错误是:
error: no matching function for call to ‘cimg_library::CImg<unsigned char>::draw_text(const char [12], int, int, const unsigned char [3])’
有任何想法吗?谢谢!