Build problem - missing #include file [message #1830175] |
Sun, 19 July 2020 14:28 |
Helen Keller Messages: 173 Registered: June 2019 |
Senior Member |
|
|
I have essentially two build problems (Eclipse 2020-03)
The following code fails to find
#include "gtkmm.h"
Here is the basic main
#include </usr/include/gtkmm-3.0/gtkmm.h>
#include "gtkmm.h"
#include <gtkmm.h>
int main() {
cout << "GTKMM Start sample code" << endl; // prints Stencil sample code
cout << "GTKMM End sample code" << endl; // prints Stencil sample code
return 0;
}
Here are the errors:
Description Resource Path Location Type
fatal error: glibmm.h: No such file or directory 1_TEST line 87, external location: /usr/include/gtkmm-3.0/gtkmm.h C/C++ Problem
make: *** [src/1_GTKMM.o] Error 1 1_GTKMM C/C++ Problem
make: *** [src/1_TEST.o] Error 1 1_TEST C/C++ Problem
recipe for target 'src/1_GTKMM.o' failed subdir.mk /1_GTKMM/Debug/src line 18 C/C++ Problem
recipe for target 'src/1_TEST.o' failed subdir.mk /1_TEST/Debug/src line 18 C/C++ Problem
unused variable 'argc' [-Wunused-variable] 1_GTKMM.cpp /1_GTKMM/src line 39 C/C++ Problem
unused variable 'argv' [-Wunused-variable] 1_GTKMM.cpp /1_GTKMM/src line 40 C/C++ Problem
initializing argument 2 of 'static Glib::RefPtr<Gtk::Application> Gtk::Application::create(int&, char**&, const Glib::ustring&, Gio::ApplicationFlags)' 1_GTKMM line 353, external location: /usr/include/gtkmm-3.0/gtkmm/application.h C/C++ Problem
My question is
why gtkmm.h cannot be found when full path syntax finds it ?
The second issue is very strange
AFTER I add `pkg-config gtkmm-3.0 --cflags --libs` in Settings → Miscellaneous
I no longer get the failure, project builds and runs, BUT in main cpp file I get
an indicator that the gtkmm.h file still cannot be found.
My full compiler options:
-O0 -g3 -Wall -c -fmessage-length=0 `pkg-config gtkmm-3.0 --cflags --libs` -v
Basically I have an error which is not an error as far as build goes.
My question
Should I care ?
One more
am I putting the backtick string in correct place ?
I am not so sure and have no idea how to verify besides actually using GTK in my code.
[Updated on: Sun, 19 July 2020 14:30] Report message to a moderator
|
|
|
|
|
Re: Build problem - missing #include file [message #1830236 is a reply to message #1830218] |
Tue, 21 July 2020 13:58 |
Helen Keller Messages: 173 Registered: June 2019 |
Senior Member |
|
|
I just "found" this How to use GTK+-3.0 or gtkmm library in Eclipse 2020-03
Exactly same subject / issue.
Will continue discussion there.
David,
the pkg-config have options NOT to add -l . That is no problem, however, the problem is , as you said - the output of pkg-config means nothing to make !
I other words - pkg-config needs to be "somewhere else " such as post-processing.
When I first started I did see some old tutorial which added pkg-config in "last option " of Eclipse.
Unfortunately I do not recall the Eclipse version.
So it may be possible that the instruction to add pkg-package was moved or is no longer available.
Actually I think all these GTK tutorials are building the GTK libray using pkg-config.
I should be able to find "libgtk-dev" and simply link to it and be done.
PS
Can you explain why people say " against library " doesn't linker links WITH library?
[Updated on: Tue, 21 July 2020 14:12] Report message to a moderator
|
|
|
Re: Build problem - missing #include file [message #1830242 is a reply to message #1830236] |
Tue, 21 July 2020 20:33 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
I'm not really sure why you are having a problem.
The output from pkg-config contains options meant for the compiler and linker command lines.
For example, the following lists the include paths needed by gtkmm (and also the -pthread option):
[dvavra@fred ~]$ pkg-config --cflags gtkmm-3.0
-I/usr/include/gtkmm-3.0 -I/usr/lib64/gtkmm-3.0/include -I/usr/include/atkmm-1.6 -I/usr/include/atk-1.0
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/glibmm-2.4 -I/usr/lib64/glibmm-2.4/include
-I/usr/include/sigc++-2.0 -I/usr/lib64/sigc++-2.0/include -I/usr/include/giomm-2.4 -I/usr/lib64/giomm-2.4/include
-I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/pangomm-1.4 -I/usr/lib64/pangomm-1.4/include
-I/usr/include/cairomm-1.0 -I/usr/lib64/cairomm-1.0/include -I/usr/include/cairo -I/usr/include/pixman-1
-I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz
-I/usr/include/gtk-3.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/libdrm
-I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include
-I/usr/include/gtk-3.0/unix-print -I/usr/include/gdkmm-3.0 -I/usr/lib64/gdkmm-3.0/include -pthread
The backticks tell Bash to send the output from the enclosed command to the command line.
You don't see the result but the program being executed does.
It only works with Make because Make executes recipes with Bash on most Linux distributions.
Make doesn't need to know what the recipes actually say.
It only cares about the order of executing them.
Setting Eclipse Settings → Miscellaneous tells Eclipse what to put into the compile recipe when creating a Makefile.
Eclipse doesn't care one whit what the setting contains.
It just passes it along.
It's also one of many ways to achieve this.
For instance, I add it directly to the command line.
The Eclipse Indexer also needs to know the paths to included files so it can scan them.
The way Eclipse is told has been developed independently from pkg-config.
Besides, pkg-config is NOT available in all systems that Eclipse supports.
The output from pkg-config tells YOU what paths are needed but it is up to YOU to tell Eclipse.
When you tell Eclipse what paths to use, you do NOT use any option flags.
Quote:the pkg-config have options NOT to add -l
Not that I am aware of.
If it does then great!
[Updated on: Tue, 21 July 2020 20:54] Report message to a moderator
|
|
|
Re: Build problem - missing #include file [message #1830244 is a reply to message #1830242] |
Tue, 21 July 2020 21:38 |
Helen Keller Messages: 173 Registered: June 2019 |
Senior Member |
|
|
Yes,
I am having an issue with (you) saying to put pkg-config as options but does not do anything. So why bother ?
In other word - why am I putting pkg-config as compiler / linker option if it is not used to compile / link via make ?
Hence the make output AKA complier verbose does not mean anything.
Then include and libraries in such output are there for what reason?
I thought pkg-config collects includes and libraries for OTHER software to use , not for me to "cut and paste " it manually. I am tempted to do so...
[Updated on: Tue, 21 July 2020 21:53] Report message to a moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03550 seconds