我想用stb_image加载图像。我从https://github.com/nothings/stb下载stb_image.h
。当我运行代码:问题用stb_image加载图像
string file="image.png";
int width,height,components;
unsigned char *imageData = stbi_load(file.c_str(),
&width, &height, &components, STBI_rgb_alpha);
我得到以下错误:
Main.cpp:(.text+0xa14): undefined reference to `stbi_load'
Main.cpp:(.text+0xb74): undefined reference to `stbi_image_free'
你应该真的阅读你正在使用的库的文档。只是'#include“stb_image.h”'是不够的... – derhass
那么什么是足够的? –