在 Debian 上跑 CxImage 本身不一定会报错,但常见会出问题,主要取决于你使用的:
原始 CxImage(~2012 年)在 新 Debian(10/11/12)+ 新 gcc 上常见错误:
error: 'nullptr' was not declarederror: invalid conversion from 'void*' to '...*'error: 'min' / 'max' is not a member of 'std'✅ 原因:老代码没写 std::min/std::max,或用了 C++11 之前写法
CxImage 依赖:
Debian 没装会报:
fatal error: png.h: No such file or directory
✅ 解决:
sudo apt update
sudo apt install libpng-dev libjpeg-dev libtiff-dev zlib1g-dev
直接 g++ *.cpp 基本必挂
git clone https://github.com/tonythecodger/cximage.git
cd cximage
mkdir build && cd build
cmake ..
make
很多 fork 已修复 Debian / gcc 问题
make -f Makefile.linux
然后链接:
-lcximage -lpng -ljpeg -ltiff -lz
结论:
| 情况 | 是否报错 |
|---|---|
| 原始 CxImage + 新 Debian | ❌ 大概率报错 |
| 修复版 / CMake 版 | ✅ 基本能跑 |
| 缺系统库 | ❌ 必报错 |
| C++11 编译 | ✅ 需加 -std=c++11 |
你可以告诉我:
cat /etc/os-release)gcc -v)我可以直接帮你改 Makefile / 源码,让它 Debian 上一次编过 ✅