Cannot include freetype headers on Linux - linux

#include <ft2build.h>
#include FT_FREETYPE_H
int main() {
return 0;
}
Here is the compiler output:
In file included from fonttest.cpp:1:
/usr/include/ft2build.h:56:10: fatal error: 'freetype/config/ftheader.h' file not found
#include <freetype/config/ftheader.h>
^
1 error generated.
I follow the official tutorial.
I have the packages installed:
i libfreetype6 - FreeType 2 font engine, shared library files
i A libfreetype6:i386 - FreeType 2 font engine, shared library files
i libfreetype6-dev - FreeType 2 font engine, development files
File /usr/include/freetype2/freetype/config/ftheader.h is there.

If someone out there is struggling, you can try
sudo apt-get install libfreetype6-dev

I think it's better to install pkg-config.
pkg-config will help the configure to find the freetype2.

Related

Trouble with QSerialPort with qtcreator on Debian

I'm currently trying to use the "QSerialPort" library on a Virtual Machine with Debian on it and can't seem to make it work. It looks like the Library straight up doesn't exist on my machine. It doesn't auto-complete when I write it out and when I try compiling I get this.
/home/debian/Downloads/mainmenu.h:15: error: QSerialPort: No such file or directory
#include <QSerialPort>
^
So I'm pretty sure I just don't have the library. Even though my version of Qt is said to have it.
-Qt Creator 4.2.0
-Based on Qt 5.7.1 (GCC 6.3.0 20170415, 64 bit)
I even have an older version of Qt creator on my Windows OS and it has the library.
I was told to get the library myself by doing this:
git clone git://code.qt.io/qt/qtserialport.git
mkdir qtserialport-build
cd qtserialport-build
qmake ../qtserialport/qtserialport.pro
sudo make install
but I can't even get through the first line before getting this:
git clone git://code.qt.io/qt/qtserialport.git
Cloning into 'qtserialport'...
fatal: unable to connect to code.qt.io:
Also tried to install the Package: libqt5serialport5 (5.2.1-1)
and it pretty much changed nothing.
You need to download and install. Just follow my instructions given below, it will help you to fix the problem.
You are very close man (Also tried to install the Package: libqt5serialport5 (5.2.1-1))
1) You have to install (via Terminal):
sudo apt-get install libqt5serialport5
sudo apt-get install libqt5serialport5-dev
2) add in the .pro file
QT += core serialport
3) int the .h file add:
#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>
4) Example Device Info
serial -> setPortName("/dev/ttyACM3"); // just example for my device
serial -> setBaudRate(QSerialPort::Baud115200);
serial -> setDataBits(QSerialPort::Data8);
serial -> setParity(QSerialPort::NoParity);
serial -> setStopBits(QSerialPort::OneStop);
serial -> setFlowControl(QSerialPort::NoFlowControl);
serial -> open(QIODevice::ReadWrite);
It is probably the best option.
Alright! I figured it out.
First problem, was accessing a git library through a Firewall/Virtual Machine.
So instead of using the git link:
git://code.qt.io/qt-creator/qt-creator.git
I used the http link, which worked:
http://code.qt.io/qt-creator/qt-creator.git
Still had some issues until I followed these steps(I didn't download the dev version of the package, I guess):
1)
sudo apt-get install libqt5serialport5
sudo apt-get install libqt5serialport5-dev
2) add in the .pro file
QT += serialport
3) int the .h file add:
#include <QtSerialPort/QSerialPort>

Included standard libraries not found by ARM cross-compiler

I'm trying to do cross-compilation for an ARM a8 processor. I'm moving the code base to a new system, and therefore it should be installed using the same compiler and makefiles as the original system.
I know that I'm using a arm-linux-gnueabihf-gcc compiler.
I've installed the following packages:
> sudo apt install gcc-arm-linux-gnueabihf
> sudo apt install binutils-arm-linux-gnueabi
When I compile the following code block:
#include <stdio.h>
// filename: simple.c
int main(void)
{
printf("I'm printing!\n");
return;
}
with this command:
> arm-linux-gnueabihf-gcc simple.c
I expect it to compile at this step. I instead get:
In file included from simple.c:1:0:
/usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory
#include <bits/libc-header-start.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Any help would be appreciated! Thank you!
I think what you are missing is the multilib packets, if I'm right, this should do the trick for you.
sudo apt install gcc-multilib g++-multilib

Installing SDL2 on Linux

I try to run simple test.cpp from Twinklebar SDL tutorial, I get this error:
test.cpp:2:10: fatal error: 'SDL2/SDL.h' file not found
So I look up the sdl development package in Ubuntu/Mint:
aptitude search sdl | grep 2
All I can find is this:
libsdl1.2-dev
Does this mean my only option is to install from sources?
It depends which Ubuntu version you are running but yes, there is a libsdl2 package for Ubuntu: http://packages.ubuntu.com/search?keywords=sdl2
The package you want is called libsdl2-dev.
Also, about the #include <SDL/SDL.h> line, it seems the recommended way doing it is by adjusting your compiler flags to add SDL's include pah and use #include "SDL.h". See https://forums.libsdl.org/viewtopic.php?t=5997 for more details on that.

manual installation of gcc

i dont have internet connection, so i installed gcc on my linux system manually through its debian package. but i am not able to compile any c code.
here is my sample c code.
#include <stdio.h>
main()
{
printf("Hellp world");
return 0;
}
the error that it shows:
ocpe#blrkec241972d:~$ gcc -o hello hello.c
hello.c:1:19: error: stdio.h: No such file or directory
hello.c: In function âmainâ:
hello.c:4: warning: incompatible implicit declaration of built-in function âprintfâ
I think i have not installed all the dependencies of compiler. Plz suggest me descriptive way to install it correctly..
Assuming by "installed manually", you mean "using dpkg -i", then you need to also install libc6-dev. I suggest further installing, at very minimum, build-essential and everything it depends on.
Debian actually has a few programs to help with offline package installation. One option is of course to use CD/DVD images. Another is to use something like apt-offline.
On my Debian system, the header files are in another package libc6-dev. You're probably missing that (and some others as well, I would guess).
What about this gcc -Wall hello.c -o hello -I/usr/include/stdio.h?
You can see your include search path by using:
echo | gcc -v -x c -E -
On my Ubuntu Linux machine i can see this output for the previous command:
#include \"...\" search starts here:
/usr/lib/gcc/i686-linux-gnu/4.6.1/include
/usr/local/include
/usr/lib/gcc/i686-linux-gnu/4.6.1/include-fixed
/usr/include/i386-linux-gnu
/usr/include
EDIT :
Install build-essential
Download from here : http://packages.debian.org/squeeze/i386/build-essential/download (assume you are 32 bits), and install dowloaded package like this:
dpkg -i build-essential.deb

Installing a graphics library on linux

I'm not a linux expert, and I'm trying to install a 2D graphics library on Ubuntu 10.10. I need to make a 2D display and after a little online research, GooCanvas seems like it will fit the bill.
I'm frustrated because it simply won't install and I don't get what I am supposed to do.
Here's what I did.
1> git clone git://git.gnome.org/goocanvas #built a goocanvas directory
2> cd goocanvas
3> ls
AUTHORS ChangeLog demo goocanvas.doap NEWS src
autogen.sh configure.in docs MAINTAINERS po TODO
autom4te.cache COPYING goocanvas-2.0.pc.in Makefile.am README
4> less README #here's what it says
To build it run './configure' and 'make'. To run the demo cd into 'demo' and
run './demo'. (Or run ./simple-demo for the very simple demo, or ./mv-demo
for the model-view demo.)
5> ./configure # error: bash: ./configure: No such file or directory
6> find . -name "configure*" -print #there aren't any other configure scripts?
'make; and 'make install' don't work either.
OK, I'm frustrated. Why does it say run configure if there isn't one? How do I install this thing?
Does anyone know an easy to use graphics library for ubuntu that will actually work. and can be easily installed?
Cairo, which is usually assumed when talking about GTK, is a good 2D library. Installing should be easy as this will be in your distributions repository (from the command line as root run apt-get install libcairo2-dev).
Now that I think about it - your new enough to Linux not to look at your repository for software first - learn to do that! I checked and found Ubuntu universe already has goocanvas, just apt-get install libgoocanvas-dev and you should be good to go.
Does anyone know an easy to use graphics library for ubuntu that will actually work.
and can be easily installed?
What is wrong with the big ones:
Qt
gtk
EFL (The Enlightenment libs)
Their instructions are out of date, execute the autogen.sh file first. You'll need the gtk-doc-tools and some other packages to support compiling things.
Edit 1:
Looks like it needs GTK 3.0, glib 2.28+, and Cairo 1.1+ - those are pretty modern. I'm not sure what Ubuntu 10.10 has them (I'm on 10.04), launch Synaptic Package Manager and search for libgtk the header files are in dev packages.
Edit 2:
What sort of graphics package are you looking for? SDL may work, or Cairo.
Using SDL
If you want to use graphics.h on Ubuntu platform you need to compile and install libgraph. It is the implementation of turbo c graphics API on Linux using SDL.
It is not very powerful and suitable for production quality application, but it is simple and easy-to-use for learning purpose.
You can download it from http://download.savannah.gnu.org/releases/libgraph/libgraph-1.0.2.tar.gz.
First install build-essential by typing
sudo apt-get install build-essential
Intall some additional packages by typing
sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-1.8 \
guile-1.8-dev libsdl1.2debian libart-2.0-dev libaudiofile-dev \
libesd0-dev libdirectfb-dev libdirectfb-extra libfreetype6-dev \
libxext-dev x11proto-xext-dev libfreetype6 libaa1 libaa1-dev \
libslang2-dev libasound2 libasound2-dev
Now extract the downloaded libgraph-1.0.2.tar.gz file.
Goto extracted folder and run following command
./configure
make
sudo make install
sudo cp /usr/local/lib/libgraph.* /usr/lib
Now you can use #include on ubuntu platform
Compile it using gcc demo.c -o demo -lglut -lGL
/* demo.c*/
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glu.h>
void setup() { glClearColor(1.0f, 1.0f, 1.0f, 1.0f); }
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f(0.0f, 0.0f, 0.0f);
glRectf(-0.75f,0.75f, 0.75f, -0.75f);
glutSwapBuffers();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutInitWindowSize(800,600);
glutCreateWindow("Hello World");
setup();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
Run it using ./demo
Check this out: We have developed a 2d Graphics library and Windowing System(GWS): https://github.com/MnMInfoTech/GWS

Resources