Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Build problem - missing #include file
Build problem - missing #include file [message #1830175] Sun, 19 July 2020 14:28 Go to next message
Helen Keller is currently offline Helen KellerFriend
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 #1830205 is a reply to message #1830175] Mon, 20 July 2020 15:55 Go to previous messageGo to next message
Helen Keller is currently offline Helen KellerFriend
Messages: 173
Registered: June 2019
Senior Member
Been reading up on usage of pkg-config.
I am using it correctly and this error seem to be Eclipse bug.
In not too technical words - the complier and linker are processing pkg-config and (make ?) have "no interest" going back to main.cpp to clean the now useless include.
All required "includes" are retrieved by pkg-config --cflags .

Any other explanation of this "problem / no problem" would be welcomed.


Re: Build problem - missing #include file [message #1830218 is a reply to message #1830205] Tue, 21 July 2020 03:45 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Eclipse and the compiler are two separate and independent things.
You have said: AFTER I add pkg-config gtkmm-3.0 --cflags ... in Settings → Miscellaneous ... project builds and runs
Settings → Miscellaneous is used by Eclipse to create Makefile recipes and nothing else.
In fact, it isn't available if the Makefile isn't being generated by Eclipse.

You still need to inform the Indexer if you don't want it to flag library references.
https://www.eclipse.org/forums/index.php?t=msg&th=1104530&goto=1830030&#msg_1830030
The output from pkg-config gtkmm-3.0 --cflags is not directly usable by Eclipse.
You have to specify the include paths without the -I flag(s).




Re: Build problem - missing #include file [message #1830236 is a reply to message #1830218] Tue, 21 July 2020 13:58 Go to previous messageGo to next message
Helen Keller is currently offline Helen KellerFriend
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 Go to previous messageGo to next message
David VavraFriend
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 Go to previous messageGo to next message
Helen Keller is currently offline Helen KellerFriend
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

Re: Build problem - missing #include file [message #1830245 is a reply to message #1830244] Wed, 22 July 2020 00:30 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Quote:
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 ?


???
You said (https://www.eclipse.org/forums/index.php?t=msg&th=1104577&goto=1830175&#msg_1830175):Quote:
AFTER I add pkg-config gtkmm-3.0 --cflags ... in Settings → Miscellaneous ... project builds and runs


What do you mean "does not do anything"?
It allowed the project to build.
So, the compiler and linker must have gotten the proper options from pkg-config.
You aren't making any sense.
Re: Build problem - missing #include file [message #1830427 is a reply to message #1830218] Sat, 25 July 2020 21:17 Go to previous messageGo to next message
Walter Williams is currently offline Walter WilliamsFriend
Messages: 3
Registered: July 2020
Junior Member
Where is the Settings → Miscellaneous ?

I am using Eclipse 2020-03 with CDT on Debian Linux.

I am trying to get the gtkmm library working my C++ project.
I am certain once I get this to work I can get other libraries to work.

Thank in advance
Walt Williams
Re: Build problem - missing #include file [message #1830428 is a reply to message #1830427] Sat, 25 July 2020 22:33 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Project --> Properties --> C/C++ Build --> Settings --> Tool Settings tab --> <compiler or linker> --> Miscellaneous
Only available when CDT is generating the Makefile.

[Updated on: Sat, 25 July 2020 22:34]

Report message to a moderator

Re: Build problem - missing #include file [message #1830429 is a reply to message #1830428] Sun, 26 July 2020 02:45 Go to previous messageGo to next message
Helen Keller is currently offline Helen KellerFriend
Messages: 173
Registered: June 2019
Senior Member
Where is the Settings → Miscellaneous ?

In Project ->Properties -.> C/C++ Build
each function has Miscellaneous

for example in Linker I add -v in Miscellaneous to get linker verbose output

I am using Eclipse 2020-03 with CDT on Debian Linux.
( warning DO NOT "upgrade " to 2020-06 )

I am trying to get the gtkmm library working my C++ project.

As far as I can tell gtkmm is yet another level above GTK - fancy word is "wrapper " .

I have found that Eclipse 2018-09 supports "pkg-config" which is a nice way to add ALL required GTK includes and libraries.
It did test it and it worked as expected . I did not bother with gtkmm, but I think it is in Ubuntu packages.
When you implement pkg-config you get a list of available packages , select the one you need and compile / link. Slick.

You can add it via "Eclipse Marketplace" . But that is the last Eclipse version which integrates with IDE that way.
The good news is - pkg-config is currently available as a library libgconf-2-4 .
I'll be implementing it soon, stay tuned.


I am certain once I get this to work I can get other libraries to work.

Thank in advance
Walt Williams
Re: Build problem - missing #include file [message #1834382 is a reply to message #1830429] Mon, 09 November 2020 12:54 Go to previous message
Mark Smith is currently offline Mark SmithFriend
Messages: 82
Registered: September 2020
Member
Please see this article
https://stackoverflow.com/questions/13417745/how-to-generate-a-list-of-missing-include-files
Previous Topic:Docker support for C/C++ cmake based project
Next Topic:How to use GTK+-3.0 or gtkmm library in Eclipse 2020-03
Goto Forum:
  


Current Time: Mon Dec 30 14:37:59 GMT 2024

Powered by FUDForum. Page generated in 0.06423 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top