I am trying to run this in linux ubuntu. When I type make it says
rgb_image.cc:26:24: fatal error: libpng/png.h: No such file or directory
#include <libpng/png.h>
Then i followed this to install png.h.
sudo install libpng-dev
But now its telling me
install: missing destination file operand after ‘libpng-dev’
What do I do?
Please help, thanks.
J. Chomel
8,04915 gold badges42 silver badges67 bronze badges
asked Apr 17, 2016 at 9:13
try rather this:
sudo apt-get install libpng-dev
Then maybe go askubuntu.com 
answered Apr 17, 2016 at 9:25
J. ChomelJ. Chomel
8,04915 gold badges42 silver badges67 bronze badges
For centOS 7 you can try
yum -y install libpng*
answered Apr 11, 2018 at 21:10
DevDev
3712 silver badges6 bronze badges
With Ubuntu 18, /usr/include/png.h moved to /usr/include/libpng/png.h
A workaround is this:
ln -s /usr/include/libpng/png.h /usr/include/png.h
Or you can configure your build to use include directory /usr/include/libpng
answered Jul 2, 2019 at 22:43
Dan AndersonDan Anderson
2,2551 gold badge8 silver badges20 bronze badges
For Centos 8, I got the below warning message :
Warning: Header file <png.h> not found.
This host has no libpng library.
Disabling support for PNG framebuffers.
and I solved it using the command :
sudo yum install libpng-devel
answered Apr 23, 2021 at 6:02
harbingerharbinger
491 silver badge4 bronze badges
For Centos 7 use below
-
libpng-devel: Development tools for programs to manipulate PNG image format filesyum install libpng-devel
J. Chomel
8,04915 gold badges42 silver badges67 bronze badges
answered Jun 30, 2018 at 8:43
1
|
outoftime ║XLR8║ 1212 / 909 / 270 Регистрация: 25.07.2009 Сообщений: 4,361 Записей в блоге: 5 |
||||||||||||
|
1 |
||||||||||||
|
29.12.2013, 00:09. Показов 3951. Ответов 8 Метки нет (Все метки)
Беда (: Вообщем есть проект на Qt и хочу сделать общие алгоритмы обработки изображений используя boost::gil. Приведу код:
В данном примере я пытаюсь собрать алгоритм вычисления тривиального градиента (код позаимствовал с официального сайта) и показать его в дополнительного окошка. Собираю проект на Qt Creator + MinGW 4.8.1 и получаю следующий лог ошибок:
Добавлено через 9 минут
Далее захожу в папку C:boost_1_55_0/boost/gil/extension/io/ и вижу что я не вижу там заголовочного файла «png.h» хотя я скачал и разархивировал boost как было сказано в гайде по установке.
0 |
|
DU 1499 / 1145 / 165 Регистрация: 05.12.2011 Сообщений: 2,279 |
||||
|
29.12.2013, 00:13 |
2 |
|||
|
загляните в png_io.hpp:
это отдельные сторонние либы, которые должны быть приделаны к проекту.
1 |
|
║XLR8║ 1212 / 909 / 270 Регистрация: 25.07.2009 Сообщений: 4,361 Записей в блоге: 5 |
|
|
29.12.2013, 00:24 [ТС] |
3 |
|
DU, А можно еще пару слов о том что это за либы и где их искать? Добавлено через 1 минуту
0 |
|
1499 / 1145 / 165 Регистрация: 05.12.2011 Сообщений: 2,279 |
|
|
29.12.2013, 00:29 |
4 |
|
да, оно. libpng требует zlib и там на сайте есть ссылка на zlib:
1 |
|
║XLR8║ 1212 / 909 / 270 Регистрация: 25.07.2009 Сообщений: 4,361 Записей в блоге: 5 |
|
|
29.12.2013, 01:24 [ТС] |
5 |
|
http://tjaden.strangesoft.net/loadpng/mingw.html нашел я такую вот фишку для того что-бы быстро поставить себе обе библиотеки. Теперь вопрос: куда это все распихать? Если я верно понимаю их содержимое нужно скинуть в корень MinGW что-бы компилятор смог их найти.
0 |
|
1499 / 1145 / 165 Регистрация: 05.12.2011 Сообщений: 2,279 |
|
|
29.12.2013, 01:50 |
6 |
|
ну да. прописать в проекте пути до новых инклудов так, чтобы при сборке, когда в исходниках
1 |
|
║XLR8║ 1212 / 909 / 270 Регистрация: 25.07.2009 Сообщений: 4,361 Записей в блоге: 5 |
|
|
29.12.2013, 02:17 [ТС] |
7 |
|
DU,
extern «C» { Там относительный путь, если я правильно помню то при относительном пути компилятор сначала ищет локальный файл а потом файл с этим названием в путях по умолчанию. Собственно вопрос о том где компилятор будет искать эти файлы по умолчанию, что-бы можно было не трогать конфигурацию проекта.
0 |
|
1499 / 1145 / 165 Регистрация: 05.12.2011 Сообщений: 2,279 |
|
|
29.12.2013, 02:29 |
8 |
|
не работаю с креатором. вот тут вроде что-то есть: самое простое в pro файле попробоват написать:
1 |
|
outoftime ║XLR8║ 1212 / 909 / 270 Регистрация: 25.07.2009 Сообщений: 4,361 Записей в блоге: 5 |
||||||||||||
|
29.12.2013, 14:25 [ТС] |
9 |
|||||||||||
|
DU, Закинул zlib & libpng хедеры в boostgilextensionio , папку библиотек добавил в проект, теперь новый лог ошибок
Кажется когда используешь библиотеку libpng надо явно указать компилятору о том что ты ее используешь а в строке 1 ее нет, проблема в этом? Добавлено через 1 час 8 минут
На примере
Работает.
0 |
-
Summary
-
Files
-
Reviews
-
Support
-
Mailing Lists
-
Tickets ▾
- Bugs
- Patches
- Feature Requests
-
News
-
Discussion
-
Wiki
Menu
▾
▴
LIBJPEG & LIBPNG not working
Created:
2015-03-20
Updated:
2015-03-26
-
Hi,
I’m trying to use libjpeg and libpng for a project about image recognition. The problem is that I’ve tried everything I’ve read in this forum to succesfully link libjpeg and libpng but it doesn’t work.
I have already uncommented
#define DLIB_JPEG_SUPPORT
#define DLIB_PNG_SUPPORT
but when I try to compile using Linux Mint and Terminal
g++ -03 -I.. dlib/all/source.cpp -lpthread -lX11 lbp.cpp -o lbp
I get this error
In file included from dlib/all/source.cpp:54:0:dlib/all/../image_loader/png_loader.cpp:13:17: fatal error: png.h: No such file or directory
include <png.h>
compilation terminated
What should I do to fix this?
Last edit: Miguel Larios 2015-03-20
-
-
When I did
cmake ..
I got this
miguel@miguel-VirtualBox ~/Downloads/dlib-18.13/examples/build $ cmake ..
— The C compiler identification is GNU 4.8.2
— The CXX compiler identification is GNU 4.8.2
— Check for working C compiler: /usr/bin/cc
— Check for working C compiler: /usr/bin/cc — works
— Detecting C compiler ABI info
— Detecting C compiler ABI info — done
— Check for working CXX compiler: /usr/bin/c++
— Check for working CXX compiler: /usr/bin/c++ — works
— Detecting CXX compiler ABI info
— Detecting CXX compiler ABI info — done
— Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so
— Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so — found
— Looking for gethostbyname
— Looking for gethostbyname — found
— Looking for connect
— Looking for connect — found
— Looking for remove
— Looking for remove — found
— Looking for shmat
— Looking for shmat — found
— Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
— Looking for png_create_read_struct
— Looking for png_create_read_struct — not found
— Looking for jpeg_read_header
— Looking for jpeg_read_header — not found
— Searching for BLAS and LAPACK
— Looking for sys/types.h
— Looking for sys/types.h — found
— Looking for stdint.h
— Looking for stdint.h — found
— Looking for stddef.h
— Looking for stddef.h — found
— Check size of void*
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
JPEG_LIBRARY
linked by target «cmTryCompileExec385043375» in directory /home/miguel/Downloads/dlib-18.13/examples/build/CMakeFiles/CMakeTmpCMake Error: Internal CMake error, TryCompile configure of cmake failed
— Check size of void* — failed
No BLAS library found so using dlib’s built in BLAS. However, if you
install an optimized BLAS such as OpenBLAS or the Intel MKL your code
will run faster. On Ubuntu you can install OpenBLAS by executing:
sudo apt-get install libopenblas-dev liblapack-dev
Or you can easily install OpenBLAS from source by downloading the
source tar file from http://www.openblas.net, extracting it, and
running:
make; sudo make install
***********
— Check for STD namespace
— Check for STD namespace — found
— Looking for C++ include iostream
— Looking for C++ include iostream — found
CMake Warning at CMakeLists.txt:115 (find_package):
By not providing «FindOpenCV.cmake» in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by «OpenCV», but
CMake did not find one.Could not find a package configuration file provided by «OpenCV» with any
of the following names:OpenCVConfig.cmake opencv-config.cmake
Add the installation prefix of «OpenCV» to CMAKE_PREFIX_PATH or set
«OpenCV_DIR» to a directory containing one of the above files. If «OpenCV»
provides a separate development package or SDK, be sure it has been
installed.— Configuring incomplete, errors occurred!
See also «/home/miguel/Downloads/dlib-18.13/examples/build/CMakeFiles/CMakeOutput.log».
See also «/home/miguel/Downloads/dlib-18.13/examples/build/CMakeFiles/CMakeError.log».Last edit: Miguel Larios 2015-03-22
-
Try using the new version of dlib. I think that will fix the error.
-
It worked but since I’m not familiar with the use of CMake, how should I compile my file? It compiles the examples but how do I try it with my program? Sorry for such a noob question.
-
If you look at the examples/CMakeLists.txt file it should be clear how to
edit it to accomplish what you want. It contains comments that explain
what to do.-
When I compiled my program it throws a lot of warnings, I put my program in folder examples and simply added addexample(lbp) which is the name of my file. But in compiling process it throws A LOT of warnings about redefinitions of DLIB_JPEG_SUPPORT and DLIB_PNG_SUPPORT
What should I do?
Last edit: Miguel Larios 2015-03-24
-
Beats me
You have to fix the errors in your program.
-
Thank you for your help. I’m having another issue, I’m trying to create a subimage of an image. So im doing this:
rectangle rect(left, top, right, bottom); //left, top, right, bottom are values
const_sub_image_proxy< array2d<int> > temp(img, rect);
and then I return temp from a function. But apparently when I do
const_sub_image_proxy< array2d<int> > head = getHead(points[0]); //funcion where I return temp
save_bmp(head, «foo.bmp»);
I doesn’t save the image, just 1 pixel. And I thought I was doing something wrong, I use gdb to debug my program and I found this:
56 const_sub_image_proxy< array2d<int> > temp(img, rect);
(gdb) print rect
$9 = {l = 66, t = 73, r = 98, b = 41}
(gdb) next
57 return temp;
(gdb) print temp
$10 = {_data = 0x7bcc4c, _width_step = 644, _nr = 0, _nc = 0}
It creates the rectangle well, but temp is created with size 0 0.
How can I fix this?
EDIT: Forget it, I found my mistake. I was calculating top and bottom wrong.
Last edit: Miguel Larios 2015-03-26
-
A sub_image is only valid as long as the original image exists. So you
can’t return it from a function if the img is local to that function.
Also, the code is a lot easier to read if you call sub_image(img,rect)
instead of writing out everything.Cheers,
DavisOn Thu, Mar 26, 2015 at 11:56 AM, Miguel Larios mikj13@users.sf.net wrote:
Thank you for your help. I’m having another issue, I’m trying to create a
subimage of an image. So im doing this:rectangle rect(left, top, right, bottom); //left, top, right, bottom are
values
const_sub_image_proxy< array2d<int> > temp(img, rect);
and then I return temp from a function. But apparently when I do
const_sub_image_proxy< array2d<int> > head = getHead(points[0]);
//funcion where I return temp
save_bmp(head, «foo.bmp»);
I doesn’t save the image, just 1 pixel. And I thought I was doing
something wrong, I use gdb to debug my program and I found this:56 const_sub_image_proxy< array2d<int> > temp(img, rect);
(gdb) print rect
$9 = {l = 66, t = 73, r = 98, b = 41}
(gdb) next
57 return temp;
(gdb) print temp
$10 = {_data = 0x7bcc4c, _width_step = 644, _nr = 0, _nc = 0}
It creates the rectangle well, but temp is created with size 0 0.
How can I fix this?
LIBJPEG & LIBPNG not working
Sent from sourceforge.net because you indicated interest in <
https://sourceforge.net/p/dclib/discussion/442518/>To unsubscribe from further messages, please visit <
https://sourceforge.net/auth/subscriptions/>
Log in to post a comment.
View Full Version : [ubuntu] Error when running «make»
cats4gold
November 20th, 2010, 04:13 AM
Today, I was trying to compile and install a minecraft mapper with the program «make». I navigated to the directory in terminal and ran make. It found the make file and begins to work, then spits an error and stops. To be specific, this was the error:
cats4gold@computer:~/Downloads/cartograph-linux$ make
make -C src/
make[1]: Entering directory `/home/cats4gold/Downloads/cartograph-linux/src’
g++ -c -pipe -O2 -Wall main.cpp -o main.o
In file included from main.cpp:16:
Level.h:8: fatal error: zlib.h: No such file or directory
compilation terminated.
make[1]: *** [main.o] Error 1
make[1]: Leaving directory `/home/cats4gold/Downloads/cartograph-linux/src’
make: *** [default] Error 2
cats4gold@computer:~/Downloads/cartograph-linux$
It just looks like a missing directory, but I was just making sure this was all. Thanks in advance.
mr_luksom
November 20th, 2010, 04:20 AM
Have you got the ‘build-essential’ package?
sudo apt-get install build-essential
You should have this before compiling.
SeijiSensei
November 20th, 2010, 04:21 AM
No, it can’t find the zlib.h header file; zlib provides support for the gzip compression algorithm.
I’m going to guess that you don’t have the kernel-headers installed; that’s where zlib.h lives in my installation. The package name depends on your version of Ubuntu. Try running «dpkg -s linux-headers-$(uname -r)» to see if you have the headers installed. If not, then use «sudo apt-get install linux-headers-$(uname -r)» to get them.
cats4gold
November 20th, 2010, 04:23 AM
No, it can’t find the zlib.h header file; zlib provides support for the gzip compression algorithm.
I’m going to guess that you don’t have the kernel-headers installed; that’s where zlib.h lives in my installation. The package name depends on your version of Ubuntu. Try running «dpkg -s linux-headers-$(uname -r)» to see if you have the headers installed. If not, then use «sudo apt-get install linux-headers-$(uname -r)» to get them.Status: install ok installed
Have you got the ‘build-essential’ package?
sudo apt-get install build-essential
You should have this before compiling.
build-essential is already the newest version.
cats4gold
November 20th, 2010, 04:43 AM
No, it can’t find the zlib.h header file; zlib provides support for the gzip compression algorithm.
I’m going to guess that you don’t have the kernel-headers installed; that’s where zlib.h lives in my installation. The package name depends on your version of Ubuntu. Try running «dpkg -s linux-headers-$(uname -r)» to see if you have the headers installed. If not, then use «sudo apt-get install linux-headers-$(uname -r)» to get them.
Actually, it appears they weren’t installed, or at least needed to be updated. No effect, though.
SeijiSensei
November 20th, 2010, 05:00 AM
http://manpages.ubuntu.com/manpages/maverick/man3/zlib.3.html
mc4man
November 20th, 2010, 05:50 AM
Do you have zlib1g-dev installed?
Edit: if not then install the ubuntu package, (sudo apt-get install zlib1g-dev ), do not do as this fellow (built and installed zlib source
http://ubuntuforums.org/showthread.php?p=10121928#post10121928
cats4gold
November 20th, 2010, 06:02 AM
Do you have zlib1g-dev installed?
Edit: if not then install the ubuntu package, (sudo apt-get install zlib1g-dev ), do not do as this fellow (built and installed zlib source
http://ubuntuforums.org/showthread.php?p=10121928#post10121928
Thanks! That solves one problem, but leads to another error:
cats4gold@computer:~/Downloads/cartograph-linux$ make
make -C src/
make[1]: Entering directory `/home/cats4gold/Downloads/cartograph-linux/src’
g++ -c -pipe -O2 -Wall main.cpp -o main.o
g++ -c -pipe -O2 -Wall Level.cpp -o Level.o
Level.cpp:2: fatal error: png.h: No such file or directory
compilation terminated.
make[1]: *** [Level.o] Error 1
make[1]: Leaving directory `/home/cats4gold/Downloads/cartograph-linux/src’
make: *** [default] Error 2
cats4gold@computer:~/Downloads/cartograph-linux$
Same thing, different missing file.
mc4man
November 20th, 2010, 06:29 AM
What you can do is search here for the file and ck. the results (scroll down to «Search the contents of packages»
Make sure you set to search the ubuntu release you’re using,
http://packages.ubuntu.com/
Ex.
these are the results on maverick for png.h
http://packages.ubuntu.com/search?searchon=contents&keywords=png.h&mode=exactfilename&suite=maverick&arch=any
So I’d take a guess and install ‘libpng12-dev’
Edit: which mapper are you trying to build?
cats4gold
November 20th, 2010, 04:15 PM
What you can do is search here for the file and ck. the results (scroll down to «Search the contents of packages»
Make sure you set to search the ubuntu release you’re using,
http://packages.ubuntu.com/
Ex.
these are the results on maverick for png.h
http://packages.ubuntu.com/search?searchon=contents&keywords=png.h&mode=exactfilename&suite=maverick&arch=any
So I’d take a guess and install ‘libpng12-dev’
Edit: which mapper are you trying to build?
I’ll take a look at these, thanks!
Also, I’m working on cartograph.
cats4gold
November 20th, 2010, 07:39 PM
Make ran succesfully and placed an executable in the folder named «cartograph»
When I right click and press open; no response. Do I need to open it from the terminal?
cats4gold
November 20th, 2010, 07:44 PM
Yes, I did. Okay, problem solved. Thanks everyone!
Powered by vBulletin® Version 4.2.2 Copyright © 2023 vBulletin Solutions, Inc. All rights reserved.
Я работаю над проектом, который требует от меня использования CImg, который, в свою очередь, требует libpng. Я использую CLion и cmake с MinGW-W64 GCC-8.1.0. Я следил за этим ответом — https://stackoverflow.com/a/41956016/11382155, чтобы настроить его.
Так выглядит мой CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(CImgProject)
set(CMAKE_CXX_STANDARD 14)
set(SOURCE_FILES main.cpp)
add_executable(CImgProject ${SOURCE_FILES})
# You can alter these according to your needs, e.g if you don't need to display images - set(YOU_NEED_X11 0)
set(YOU_NEED_X11 1)
set(YOU_NEED_PNG 1)
if(${YOU_NEED_X11} EQUAL 1)
message(STATUS "Looking for X11...")
find_package(X11 REQUIRED)
include_directories(${X11_INCLUDE_DIR})
target_link_libraries(CImgProject ${X11_LIBRARIES})
else()
target_compile_definitions(CImgProject PRIVATE cimg_display=0)
endif()
if(${YOU_NEED_PNG} EQUAL 1)
message(STATUS "Looking for libpng...")
set(ZLIB_ROOT "CImg283/zlib-1.2.11")
set(ZLIB_LIBRARY "CImg283/zlib-1.2.11")
set(PNG_ROOT "CImg283/lpng1637")
set(PNG_LIBRARY "CImg283/lpng1637")
find_package(PNG REQUIRED)
include_directories(${PNG_INCLUDE_DIR})
target_link_libraries (CImgProject ${PNG_LIBRARY})
target_compile_definitions(CImgProject PRIVATE cimg_use_png=1)
endif()
Это мой main.cpp
#include "CImg283/CImg.h"
using namespace cimg_library;
int main() {
CImg<unsigned char> img(640,400,1,3); // Define a 640x400 color image with 8 bits per color component.
img.fill(0); // Set pixel values to 0 (color : black)
unsigned char purple[] = { 255,0,255 }; // Define a purple color
img.draw_text(100,100,"Hello World",purple); // Draw a purple "Hello world" at coordinates (100,100).
img.display("Window Title"); // Display the image in a display window.
img.save_png("test.png"); // Save as PNG to prove we linked correctly
return 0;
}
У меня проблема в том, что когда я нажимаю build, я получаю следующую ошибку
====================[ Build | CImgProject | Debug ]=============================
"C:Program FilesJetBrainsCLion 2019.1bincmakewinbincmake.exe" --build C:UsersbhaveOneDriveDesktopuntitledcmake-build-debug --target CImgProject -- -j 6
Scanning dependencies of target CImgProject
[ 50%] Building CXX object CMakeFiles/CImgProject.dir/main.cpp.obj
In file included from C:UsersbhaveOneDriveDesktopuntitledmain.cpp:3:
C:UsersbhaveOneDriveDesktopuntitledCImg283/CImg.h:447:10: fatal error: png.h: No such file or directory
#include "png.h"
^~~~~~~
compilation terminated.
mingw32-make.exe[3]: *** [CMakeFilesCImgProject.dirbuild.make:63: CMakeFiles/CImgProject.dir/main.cpp.obj] Error 1
mingw32-make.exe[2]: *** [CMakeFilesMakefile2:75: CMakeFiles/CImgProject.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFilesMakefile2:82: CMakeFiles/CImgProject.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:117: CImgProject] Error 2
Я не знаю, почему эта ошибка появляется, когда cmake может найти libpng, и я проверил, что png.h определенно существует.


You have to fix the errors in your program.