![]() Then I get: $ g++ example.cpp -o example `freetype-config -cflags` -I/usr/local/include -L/usr/local/lib -lpng -lPNGwriter -lz -lfreetype Here I figured out that I needed to replace -lpngwriter with -lPNGwriter (i.e., the manual is erroneous). If I instead actually add the directory containing freetype2.pc (I found it by going to / and using find -name "freetype2.pc") to the environment variable (added export PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig/:$PKG_CONFIG_PATH to ~/.bashrc and did source ~/.bashrc) then I get new errors $ g++ example.cpp -o example `freetype-config -cflags` -I/usr/local/include -L/usr/local/lib -lpng -lpngwriter -lz -lfreetypeĬollect2: error: ld returned 1 exit status The answer to this Stack Overflow question ( Trying to install pygame on ubuntu which gives error) suggests to install libfreetype6-dev, but I apparently have the latest version already whereby the errors remain unchanged. usr/local/include/pngwriter.h:66:22: fatal error: ft2build.h: No such file or directory Sed: -e expression #1, char 0: no previous regular expression Package 'freetype2', required by 'virtual:world', not found To the PKG_CONFIG_PATH environment variable Perhaps you should add the directory containing `freetype2.pc' Package freetype2 was not found in the pkg-config search path. The PNGwriter manual instructs to compile as g++ -o my_program `freetype-config -cflags` -I/usr/local/include -L/usr/local/lib -lpng -lpngwriter -lz -lfreetypeīut I get errors $ g++ example.cpp -o example `freetype-config -cflags` -I/usr/local/include -L/usr/local/lib -lpng -lpngwriter -lz -lfreetype Now, let's say I'd like to compile the PNGwriter quickstart example: #include What if I have a single source file and compile it manually in the terminal? ![]() Questions: Does the second part regarding "CMakeLists.txt" depend on whether PNGwriter was installed in a system path? What is "CMakeLists.txt"? I assume it's some file one's IDE creates, but my NetBeans projects don't seem to contain such files. Do I just type the environment hint to the terminal or add it to some file? If the former then does it need to be given every time I open a new terminal session? Is "somepath" /usr/local/lib, /usr/local/include or something else? Questions: How do I know if PNGwriter was or wasn't installed in a system path? I have libPNGwriter.a in /usr/local/lib and pngwriter.h in /usr/local/include - does this mean that it was installed in a system path? When installing I simply tried to follow the instructions above. Target_link_libraries(YourTarget PRIVATE PNGwriter::PNGwriter) Use the following lines in your projects CMakeLists.txt: find_package(PNGwriter 0.7.0) The instructions on GitHub say the following about linking:įirst set the following environment hint if PNGwriter was not installed in a system path: # optional: only needed if installed outside of system pathsĮxport CMAKE_PREFIX_PATH=$HOME/somepath:$CMAKE_PREFIX_PATH This was many hours of struggling ago so I, unfortunately, don't remember what kind of errors or problems I was encountering at this point. I then installed PNGwriter manually, but still couldn't compile anything with it. I managed to install Spack and then PNGwriter, but couldn't compile the simplest program with it and wasn't able to figure out why. # for own install prefix append: -DCMAKE_INSTALL_PREFIX=$HOME/somepath PNGwriter >can then be installed using CMake: git clone The installation instructions on GitHub advise to do one of the following:įirst install the dependencies zlib, libpng, and (optional for text support) freetype. Any help would be much appreciated.ĭisclaimer: I have a weird background in the sense that I have many years of experience in using Unix-like operating systems, doing stuff in the terminal, and writing code, but I know little/nothing about installing software from the source code or compiling programs manually or with makefiles from multiple source code files. I read that this should be fairly easy using PNGwriter ( ), but I've spent many hours struggling with installing it (on Ubuntu) and compiling my code with it. I'd like to learn how to write PNG images pixel-by-pixel using both RGB and HSV color models with C++.
0 Comments
Leave a Reply. |