Reputation: 691
I'm not gonna waste too much time moaning about how difficult it is coming from Java, a language where you quite literally click a button and select a file to add external libraries to a project, to C++ where it seems impossible to do without the patience of an owl. I didn't think I'd ever have to post a question like this since it seemed quite elementary but it's been at least 3 weeks of trying and failing. I've also read the vague documentation provided by the eclipse website and it doesn't really cover anything at all.
For example, let's say gtkmm-3.0. I have installed that on my linux machine and everything is fine. Why isn't it possible to just do:
#include <gtkmm-3.0/gtkmm.h>
since that does come up as a suggestion in Eclipse. At this stage, I'm already at a loss since I think a good IDE shouldn't give suggestions for things that aren't actually usable and if it does,it should at least automatically include them or something.
I have also tried and failed many times with other libraries and asked for help from a full-time C++ developer that I know and he couldn't work his head around the error either.
tl;dr - Download lib off internet, open eclipse, what do?
Sorry if this question seems silly. The depression is honestly just.. terrible when 'working' with C++.
Upvotes: 1
Views: 250
Reputation: 7566
The best way I have found for including and linking against the appropriate libraries has been to create build variables for all configurations. This way I can have one place where I add/remove libraries and flags as needed.
[All Configurations]
GTK_CFLAGS
and for the value, it is a string of the type `pkg-config gtkmm-3.0 --cflags`(those are back ticks)GTK_LIBS
and use the flag --libs
instead of --cflags
.GCC C++ Compiler
(or whatever compiler you are using)${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} -std=c++11
) add ${GTK_CFLAGS}
(or whatever you called it) after the command macroGCC C++ Linker
and in the command line pattern after ${INPUTS}
put ${GTK_LIBS}
and select applyThis should let you compile with GTKmm, there may still be issues with the indexer and autocomplete. If you want to include specific header files so that your indexer and autocomplete can seen them. You can do that in C/C++ General-> Paths and Symbols
and add the include directory and then select apply and rebuild your index.
Upvotes: 1