[Qt-interest] Qt mocks issue multiple definition of
Alex Ivasyuv
industral at gmail.com
Sun Oct 31 22:35:29 CET 2010
On 10/31/2010 11:24 PM, Scott Aron Bloom wrote:
>
> *From:*Alex Ivasyuv [mailto:industral at gmail.com]
> *Sent:* Sunday, October 31, 2010 2:16 PM
> *To:* Scott Aron Bloom
> *Cc:* qt-interest at trolltech.com
> *Subject:* Re: [Qt-interest] Qt mocks issue multiple definition of
>
> On 10/31/2010 11:08 PM, Scott Aron Bloom wrote:
>
> Surprised...
>
> However, I will say this.. you are asking qmake to have multiple files
> target the same object file...
>
>
> Are they the same if they're in different namespaces?
>
> Absolutely...
>
> The object file is based on the cpp file name, NOT the contents of the
> file.. You could have 10 classes of different namespaces defined in
> the .cpp file, and they all go to the same .o file.
>
Yes, if I have 10 classes in one file. But in this case it's in separate
folders...
Check it out:
$ g++ A/MyClass.cpp B/MyClass.cpp main.cpp
the same code compile success.
Another one example:
$ g++ A/MyClass.cpp -c -o A_MyClass.o
$ g++ B/MyClass.cpp -c -o B_MyClass.o
$ g++ main.cpp -c -o main.o
$ g++ main.o A_MyClass.o B_MyClass.o -o myapp
It's absolutely controlled... And I think qmake should creates
appropriate Makefile based on paths instead of filenames, e.g.
A_MyClass.o: ....
B_MyClass.o: ....
And now snipped from generated Makefile:
####### Compile
main.o: main.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
MyClass.o: A/MyClass.cpp A/MyClass.hpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o MyClass.o A/MyClass.cpp
MyClass.o: B/MyClass.cpp B/MyClass.hpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o MyClass.o B/MyClass.cpp
####### Install
Two identical target names: MyClass.o
You right, it should be posted in bug tracking system...
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
--
Best regards,
Alex Ivasyuv
Senior WebUI Software Engineer
ReelRoles, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101031/9c4b7b70/attachment.html
More information about the Qt-interest-old
mailing list