You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.
So I made two projects for this example. The first one, lets say this is my project I want to work on, is named here example_for_libraries. The other project, which should become a shared library, which I can then use in my example_for_libraries project, is called asdXdShared (ignore the naming, it's all just supposed to be a simple example).
Here is the asdXdShared.pro file:
It is located inside the asdXdShared project folder (ignore the path at the top)
Here is the asdXdShared.pri file, which is located inside example_for_libraries/libs/asdXdShared.pri:
I include this .pri file in my project (example_for_libraries) like this:
This is the file example_for_libraries.pro located in the project path of the project example_for_libraries.
This is how the build tree looks like for the example_for_libraries project:
And this is the build tree for the asdXdShared project:
These are the same trees just as type file system I think:
(example_for_libraries)
(asdXdShared)
Now, in my project (example_for_libraries) I can do this, in, e.g. file main.cpp:
Note the include path! It contains libs/asdXdShared and then the actual AsdXdShared.hpp file
That is exactly what I dont want.
I want to be able to include the files like this: #include "AsdXdShared.hpp"
What do I need to to, or what do I need to specifiy, so that I am able to do this?
I took some inspiration from the communi/libcommuni project, for which you can just do: #include "IrcConnection.hpp"
For example, and not: #include "libs/libcommuni/src/core/IrcConnection.hpp"
By adding a file like, e.g. libs/libcommuni.pri containing this into your project folder (or project/libs folder):
The text was updated successfully, but these errors were encountered:
Now, I am able to include the headers file from this project like this, for example, which I want:
The build tree as file system looks like this for project asdXdShared:
However, now, when I want to add new files to the project, I have to change the path for the header/source files in the asdXdShared.pro file and I have to prepend them with a $$PWD/ like this:
Is this really the right way? Or am I on a completely different path? :/
So I made two projects for this example. The first one, lets say this is my project I want to work on, is named here
example_for_libraries
. The other project, which should become a shared library, which I can then use in myexample_for_libraries
project, is calledasdXdShared
(ignore the naming, it's all just supposed to be a simple example).Here is the
asdXdShared.pro
file:It is located inside the
asdXdShared
project folder (ignore the path at the top)Here is the
asdXdShared.pri
file, which is located insideexample_for_libraries/libs/asdXdShared.pri
:I include this
.pri
file in my project (example_for_libraries
) like this:This is the file
example_for_libraries.pro
located in the project path of the projectexample_for_libraries
.This is how the build tree looks like for the
example_for_libraries
project:And this is the build tree for the
asdXdShared
project:These are the same trees just as type file system I think:
(
example_for_libraries
)(
asdXdShared
)Now, in my project (
example_for_libraries
) I can do this, in, e.g. filemain.cpp
:Note the include path! It contains
libs/asdXdShared
and then the actualAsdXdShared.hpp
fileThat is exactly what I dont want.
I want to be able to include the files like this:
#include "AsdXdShared.hpp"
What do I need to to, or what do I need to specifiy, so that I am able to do this?
I took some inspiration from the
communi/libcommuni
project, for which you can just do:#include "IrcConnection.hpp"
For example, and not:
#include "libs/libcommuni/src/core/IrcConnection.hpp"
By adding a file like, e.g.
libs/libcommuni.pri
containing this into your project folder (or project/libs folder):The text was updated successfully, but these errors were encountered: