Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Avoiding name clashes with Qmake if two files in project have the same name.
I have the following folder structure:
So in the folder Linux and before it there is a Process.cpp. Now when I try to compile this I run in trouble because it looks like QMake threats this like if the file
Process.hshows up 2 times.
From the code Both classes in the files are separated by a namespace. One is simply
The otherone with a namespace:
I had similar expediences with Visual Studio. There you could tell the build system to build with the paths your project is organized to not have this clash.
Any chance I can also solve that issue in qmake? Or do I really have to rename one file?
Or do I really have to rename one file?
Rename the file to not get into trouble sooner or later with whatever build system you use (and by yourself).
I thought with the folder system and the namespace I can avoid long names. Is there really no way?
Why have namespaces when they are not usefull.
Now when I try to compile this I run in trouble because it looks like QMake threats this like if the file Process.h shows up 2 times.
Shows up where?
What exactly is the problem?
The error states that Process.o already exists when he trys to generate the second Process.o
yes since all output goes to the same folder, having files with the same names will overwrite each other .o file.
So basically its just a bad idea that will come back and hurt you. :)
- Why have namespaces when they are not usefull.
They are used to avoid name clash for types internally.
Not to protect from name clash on files.
at one point in time one could do
CONFIG += object_parallel_to_source
CONFIG += object_with_source
But Moc dont understand this so if Qt based classes, its a no go.
- I thought with the folder system and the namespace I can avoid long names. Is there really no way?
What long names ?