Avoiding name clashes with Qmake if two files in project have the same name.
-
I have the following folder structure:
/linux
- Process.h
Process.h
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.h
shows up 2 times.From the code Both classes in the files are separated by a namespace. One is simply
class Process.
The otherone with a namespace:
class Linux::Process
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?
-
@sandro4912 said in Avoiding name clashes with Qmake if two files in project have the same name.:
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.
-
@sandro4912 said in Avoiding name clashes with Qmake if two files in project have the same name.:
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
-
@sandro4912
hi
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
or
CONFIG += object_with_sourcehttps://stackoverflow.com/questions/9450225/why-does-qmake-put-all-object-o-files-to-one-directory
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 ?