
Originally Posted by
marcvanriet
I would create a new file, not modify an existing file. Nothing would be broken.
If you upgrade some library it will be a nightmare to check for changes in its header files and compare them against your "new file".
It was not what I meant, but may be a good alternative. That way I don't have to add all the include directories in my .pro file.
No but you will have to include them in other (possibly many) files.
Might work if I use relative paths and indeed put all the other files in a consistent location.
This is asking yourself for trouble. If you copy things, you'll soon end up with several copies of the same files and the already mentioned Murphy's law will make you use the wrong version of the file now and then (possibly when you're just approaching a deadline).
That won't work if the header files themselves include header files.
The only way to merge header files is to use cpp (or equivalent) but then its output depends on the definitions passed to it so it is bound to fail. Just like any attempt to "merge" header files. Consider my classic example:
#ifndef A_H
#define A_H
#ifndef X
#define X true
#endif
#endif
#ifndef A_H
#define A_H
#ifndef X
#define X true
#endif
#endif
To copy to clipboard, switch view to plain text mode
#ifndef B_H
#define B_H
#ifndef X
#define X false
#endif
#endif
#ifndef B_H
#define B_H
#ifndef X
#define X false
#endif
#endif
To copy to clipboard, switch view to plain text mode
So if you merge files in order a.h, b.h X will be defined to true but if you merge it as b.h, a.h then it will be false and different projects might need different values of X. You just can't process header files aprori to actually compiling the project (with the only exception of precompiled headers which technically does "merge" files but it doesn't process them).
Well, it wouldn't change anything of the software involved.
It would surely make some people lose their hair.
It is only for USING this library that I would like a convenient way to have access to the includes.
If you want convinience then create a file containing needed include directives (like mylibrary.pri for qmake) and include it in your makefile. But stay away from header files themselves.
Well, I'm not distributing the library or its source code in any form.
Which doesn't mean you are not breaking some licence.
Also, I only create personal or in-house software, not something that is going to customers.
Same as above.
So licensing should be no problem (don't start a flame war now

)
It's not that easy. If a licence says you can't use the software in some way then you can't use it regardless if you create software for yourself or for someone else. World doesn't end with GPL and LGPL.
Yes, I now that in Linux/Unix everything is just thrown somewhere in /usr/ or /etc or something and it is different for different distributions, and after installing dozens (versions of) libraries you have no idea what is on your system.
You know nothing then. If you install a library, it usually gets its own subdirectory inside /usr/include with version appended to the directory name to avoid conflict.
I rather put the libraries and their include files in a location of my own choice.
And what is stopping you from doing that exactly?
I don't understand why this would be a big no-no. I didn't come up with this idea. Sqlite is distributed as an
'amalgamation' and all includes are also put in 1 big "sqlite3.h". Are you all saying that the sqlite people are wrong ?
SQLite is a very small project, it exports less than 200 symbols and they all fit into a single file because they are always used together. And you are actually wrong that it puts everything in one file. Firstly there is also <sqlite3ext.h> and secondly <sqlite3.h> includes <stdarg.h> which is a standard include file. If id did what you ask for, instead of including stdarg.h it would pull its contents (and all its dependencies) into <sqlite3.h>. So if you upgraded stdarg.h on your system, you'd have to upgrade sqlite3.h as well. What you are trying to do (and the way you are trying to do it) is just a Bad Idea (TM).
Bookmarks