Problems compiling gtkmm

前端 未结 2 1660
后悔当初
后悔当初 2021-02-04 04:54

OS: Fedora 14

Compiler: g++ (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)

I installed gtkmm24-devel from repository via yum. To make sure the install went as planned I

相关标签:
2条回答
  • 2021-02-04 05:31

    These steps usually help resolving this problem:

    • Search your computer for glibmm.h
      • If found - add its directory to the include path list
      • If not found - Google for glibmm.h and find out which library it is contained in. You will find out in this case it's (surprise!) glibmm. Install it using your package manager.

    The problem, as noted in comments, is a compiler error and the compiler is arguing about a missing (header) file. The steps I described above either find the location of the missing file or help you to install a library that the header file belongs to.

    0 讨论(0)
  • 2021-02-04 05:35

    Short answer

    Use the output of 'pkg-config gtkmm-2.4 --cflags' for include paths and 'pkg-config gtkmm-2.4 --libs' for libraries to link.

    Long answer

    It said it couldn't find gtkmm.h, no problem, I just forgot to link the library.

    Building a C/C++ program is done in two separate steps. First the source files are compiled, outputting object files; and then the object files are linked together. The error you are getting comes from the compiling step.

    On Linux, most libraries come with pkgconfig files to make it easier for other programs to use the libraries. gtkmm also comes with its own pkgconfig files.

    You are trying to manually specify /usr/include/gtkmm-2.4 for include path; this is wrong. Instead, use the output of pkgconfig to figure out where the header files are located. To get all the include directories needed for gtkmm, use the following command:

    pkg-config gtkmm-2.4 --cflags
    

    For linking, use the following pkgconfig command to get the libraries you need to link with:

    pkg-config gtkmm-2.4 --libs
    

    You can test it on the command line by invoking g++ directly.

    g++ myfirstprogram.cpp -o myfirstprogram `pkg-config gtkmm-2.4 --cflags --libs`
    

    For more information, see the gtkmm docs: http://library.gnome.org/devel/gtkmm-tutorial/unstable/sec-basics-simple-example.html.en

    0 讨论(0)
提交回复
热议问题