0

I'm not quite completely understand how linux or g++ (gcc) define what include path it need to use to find some package. Here is what I mean:

I actually have a c++ project in QtCreator and I use qmake build system. I include in my code a header-only framework file, which needs a Boost of one of the last version. I have already in my system boost-1.64.0, but it's too old, so I've installed boost-1.80.0. But when I try to build the program a compilation error raises with the text:

{name_of_my_pro_file}.pro: rpm boost1.64.0-devel is not installed!!!

I thought if I just replace boost folder in /usr/include/ or /usr/local/include/ with folder of the newer boost version linux can use it instead of older one. But the error mentioned above still raises. I've tried to edit boost folder name in Makefile. Directly in my .pro file there is not any mentions about boost. But nothing helped me. I can handle it only when I renamed boost-1.80.0 folder to boost-1.64.0. And now it works.

It seems that name boost-1.64.0 is written somewhere in the system and it doesn't see any other packages.

I guess that I just don't understand how to work with this stuff correctly and doing something wrong. Can somebody explain what should I do?

My distro is Oracle Linux Server 8.4.

EDIT:

My .pro file:

QT += core gui network xml
QMAKE_CXXFLAGS += -std=c++0x
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = TilesDataProvider
TEMPLATE = app
#DESTDIR = ./output

DEFINES += QT_DEPRECATED_WARNINGS

DEFINES += QT_DEPRECATED_WARNINGS
CONFIG += no_abi_dump

INCLUDEPATH += \
    $$PWD \
    $$PWD\guts \
    $$PWD\SRTM \
    $$PWD\tileSources \
    /usr/include

CONFIG(release, debug|release){
message(release)
    TARGET = TilesDataProvider
    OBJECTS_DIR = tmp/TilesDataProvider/release
    MOC_DIR     = tmp/TilesDataProvider/moc
}
CONFIG(debug, debug|release){
message(debug)
    TARGET = TilesDataProvider_d
    OBJECTS_DIR = tmp/TilesDataProvider/debug
    MOC_DIR     = tmp/TilesDataProvider/moc

    DEFINES += _DEBUG
}
SOURCES += \
        main.cpp \
    tileSources/MapTileSource.cpp \
    tileSources/SrtmTileSource.cpp \
    guts/Position.cpp \
    guts/t_task.cpp \
    guts/MapConversions.cpp \
    SRTM/altdatabank.cpp \
    SRTM/altdatamap.cpp \
    SRTM/geoid.cpp \
    SRTM/srtm_coordinate.cpp \
    SRTM/t_geodata.cpp \
    SRTM/t_pageid.cpp \
    t_image.cpp \
    tilesdataprovider.cpp


HEADERS += \
    tileSources/MapTileSource.h \
    tileSources/SrtmTileSource.h \
    guts/MapGraphics_global.h \
    guts/Position.h \
    guts/t_task.h \
    guts/MapConversions.h \
    SRTM/altdatabank.h \
    SRTM/altdatamap.h \
    SRTM/geoid.h \
    SRTM/srtm_coordinate.h \
    SRTM/t_geodata.h \
    SRTM/t_pageid.h \
    SRTM/tiff_param.h \
    t_image.h \
    tilesdataprovider.h
NordMan
  • 127
  • 1
  • 6
  • Exactly what's happening depends on your `.pro` file and your configuration. What are you doing? How are you adding directories to the header-file search path list? – Some programmer dude Oct 18 '22 at 08:42
  • @Someprogrammerdude, in .pro file I added `/usr/include/` to INCLUDEPATH variable. – NordMan Oct 18 '22 at 08:51
  • 1
    If you run e.g. `gcc -xc++ -E -v -` (courtesy of [this old answer](https://stackoverflow.com/a/6666338/440558) and press the `EOF` key `Ctrl-D` to end, then you will see a list of paths used for include files. I would be *very* surprised if `/usr/include` isn't there. If you don't show us the `.pro` file we just can't help you solve whatever problem you might have with it. – Some programmer dude Oct 18 '22 at 09:06
  • 1
    And don't replace any system directories. If you install new packages and it installs in a non-standard location you need to add that non-standard location to the search path. – Some programmer dude Oct 18 '22 at 09:07
  • 1
    By the way, you say you installed the `boost-1.80.0` package, but did you install the *development* package as well (I assume it's named `boost-1.80.0-devel`)? – Some programmer dude Oct 18 '22 at 09:08
  • @Someprogrammerdude, no, I didn't install `boost-1.80.0-devel`. – NordMan Oct 18 '22 at 09:32
  • Well, the development packages are usually where the header files are installed from. If you don't install the development package, then you wont have any header files to include. – Some programmer dude Oct 18 '22 at 09:35
  • @Someprogrammerdude, I'm sorry, but I'm not sure where should I seek devel package? In boost site? In other sites? I thought, that the tar file I downloaded from boost site contains all I need, isn't it? – NordMan Oct 18 '22 at 09:57
  • Oh, so you didn't install an RPM package, but downloaded the source and built it? Then where was it installed? In `/usr/local`? Then you should look in the `/usr/local/include` directory to search for the header files. – Some programmer dude Oct 18 '22 at 10:01
  • @Someprogrammerdude, ok,but is an RPM package required? Can I use boost without it? – NordMan Oct 18 '22 at 10:28
  • Of course, if you build and install from source into a custom location, you can just add the paths to the custom location to the ones that the compiler and linker will use. It's quite common for older systems where newer packages might not be available. You just need to know where the installation is, where the header files are located, where the libraries themselves are located, and then add those paths to the appropriate `.pro` variables. For example, assuming the header files have been installed to `/usr/local/include` then add that path to `INCLUDEPATH`. – Some programmer dude Oct 18 '22 at 10:32
  • /usr/include and /usr/local/include are always searched. You should never ever touch these directories other than by doing normal package installations/updates. It is ratyer unlikely that boost-1.64.0 is written somewhere in the system where gcc can find it, but it could be written in the generated makefile. – n. m. could be an AI Oct 18 '22 at 10:44
  • Some part of your build is looking for that rpm, it's not gcc. I'd guess it's a library you're using if you haven't configured that yourself. Maybe searching for `is not installed!!!` will find the culprit? – Alan Birtles Oct 18 '22 at 11:15
  • Well, thanks everyone. I've not solved my problem entirely, but I've got some ideas what I can try to do. – NordMan Oct 18 '22 at 14:06

0 Answers0