PDA

View Full Version : cross compile problems - Undefined rinterface & ASSERT failure



davidovv
3rd December 2012, 23:37
I have linux ubuntu 12.04 with Qt 4.8.1 (latest from repository)
and windows xp sp3 with Qt 4.8.1 (Qt SDK 1.21 mingw)
and a aplication that i mainly develop on linux and when time comes, just compile windows version.
With some "advanced" changes in the code i am not able to compile my code on windows

1. The compile fails with error: "Undefined interface"
and when i rearange my code to comment lines with Q_INTERFACES macro it compiles fine.
Nothing wrong on linux

2. I created a model extending QAbstractItemModel that also works on linux, but when application is started on windows i get error:
ASSERT failure in QAbstractItemView::setModel: "A model should return the exact same index (including its internal id/pointer) when asked for it twice in a row.", file itemviews/qabstractitemview.cpp, line 667

I dont think i am doing anything wrong if it works on linux, or am I?

amleto
4th December 2012, 06:55
The fact that you get an assert from qt means you have done something wrong.

you need to fix the compiler error properly, not randomly cut out bits of your code. Of course you can't say 'it must be ok now since it works on nix' because now you have two different apps!

davidovv
4th December 2012, 11:45
The first one is with Q_INTERFACES. That should realy be platform independant.
I comment it out just to see is that the only problem, and it isn't.
I plan to fix it (with help from here), not to leave it commented (i spent some time to create the interface)
The other problem, you are right about one thing, i should not skip to next problem before solving first one.
Anyway, that code has nothing in common with interface, and should also be platform independant.
The thing that worries me is that it doesnt feel like "code once, deploy everywhere",

For the QAbstractModel part, i went to qt source of QAbstractTableModel, and checked implementation, and fixed my own. The question remains, why there isn't ASSERT in linux if it was "something wrong"
For the Q_INTERFACE part still need help, anyone had simmilar problem, or i am one of few trying to use Q_INTERFACE?

amleto
4th December 2012, 12:16
because *nix compilers and win compilers aren't identical. They will not be 100% c++ standard conformant, and indeed some of them let you get away with non-conformant code by filling in the blanks.

If you want help with your problem, please read my sig.

Added after 7 minutes:

oh, and btw, I have just checked 'undefined interface' as it smells a bit - and I was right to suspect something. It is not a c++ compiler error, but a moc error.

http://lists.trolltech.com/qt-interest/2005-12/thread00531-0.html

davidovv
5th December 2012, 00:32
I created a new project that contains just interface class and implementation class. The project compiled fine. Then i checked compile outputs of working and failing versions.
There was a significant difference in moc.exe command
working wersion didn't have a parameter "@debug/mocinclude.tmp"
Before this thread i googled for "undefined interface" and some results sugested that i shoud remove mocinclude.tmp, and i did that, but without success, it is recreated with same error.
What is this file, how to avoid creating it? Linux version also executes moc command without "@debug/mocinclude.tmp" parameter.
Anyone familiar with this?
@amleto: is example stil needed?
How do i edit moc parameters?

I created a new project that contains just interface class and implementation class. The project compiled fine. Then i checked compile outputs of working and failing versions.
There was a significant difference in moc.exe command
working wersion didn't have a parameter "@debug/mocinclude.tmp"
Before this thread i googled for "undefined interface" and some results sugested that i shoud remove mocinclude.tmp, and i did that, but without success, it is recreated with same error.
What is this file, how to avoid creating it? Linux version also executes moc command without "@debug/mocinclude.tmp" parameter.
Anyone familiar with this?
@amleto: is example stil needed?
How do i edit moc parameters?

Added after 37 minutes:

DAMN!!!
I Lost two days over this stupidity.
I hope this thread saves someone else's time
searching for info about mocinclude i found it in Makefile.Debug
and there i noticed that moc is generated like this


debug/mocinclude.tmp:
...
@echo -IC:/Documents>> debug/mocinclude.tmp
@echo -Iand>> debug/mocinclude.tmp
@echo -ISettings/Administrator/Desktop/myProject/trunk/Core>> debug/mocinclude.tmp
...
it split "Documents and settings" into 3 includes
after moving project to c:\ everything compiled fine.

The strangest thing is that the new test project is also on desktop and no errors