[Interest] Failed to make moc for cpp source file.

Igor Mironchik igor.mironchik at gmail.com
Tue Feb 10 14:23:28 CET 2015


Hi. In QtCreator sources I found next:

QProcess proc;
proc.setProcessEnvironment(androidToolEnvironment().toProcessEnvironment());
proc.start(androidToolPath().toString(), QStringList() <<  
QLatin1String("list") << QLatin1String("target")); // list avaialbe AVDs
if (!proc.waitForFinished(5000)) {
     proc.terminate();
     return;
}

SdkPlatform platform;
while (proc.canReadLine()) {
     const QString line = QString::fromLocal8Bit(proc.readLine().trimmed());
     if (line.startsWith(QLatin1String("id:")) &&  
line.contains(QLatin1String("android-"))) {
         int index = line.indexOf(QLatin1String("\"android-"));
         if (index == -1)
             continue;
         QString androidTarget = line.mid(index + 1, line.length() - index  
- 2);
         platform.apiLevel =  
androidTarget.mid(androidTarget.lastIndexOf(QLatin1Char('-')) + 1).toInt();

So I guess that my machine is so slow... :)

On Tue, 10 Feb 2015 14:32:37 +0300, Igor Mironchik  
<igor.mironchik at gmail.com> wrote:

> I don't know what it was. But I much times deleted build directory and  
> .user file.
> And again and again tried to build project with the same symptoms. And I  
> saw that all that times in .user file
>
> <value type="QString" key="BuildTargetSdk">android--1</value>
>
> was.
>
> But after the next turn. QtCreator generated correct .user file with
>
> <value type="QString" key="BuildTargetSdk">android-21</value>
>
> and all became ok.
>
> What was it?
>
> Where from QtCreator takes BuildTargetSdk value. As I understand all  
> that failed times some tool returns -1. What is that tool?
>
> Thanks.
>
> On Tue, 10 Feb 2015 12:30:27 +0300, Igor Mironchik  
> <igor.mironchik at gmail.com> wrote:
>
>> Hi. I ran into a problem.
>>
>> When building project for Android target, build doesn't make moc for a  
>> cpp file and compilation failed.
>>
>> In that cpp I have Q_OBJECT and #include "messagebox.moc"
>>
>> In Makefile generated I have:
>>
>> mocables: compiler_moc_header_make_all compiler_moc_source_make_all
>>
>> compiler_moc_source_make_all: .moc\messagebox.moc
>>
>> But I got:
>>
>> ..\..\..\Mobile\QtMWidgets\src\messagebox.cpp:622:26: fatal error:  
>> messagebox.moc: No such file or directory
>>   #include "messagebox.moc"
>>                            ^
>> compilation terminated.
>>
>> How can I fix it? Thank you.
>>
>
>


-- 
Best Regards,
Igor Mironchik.



More information about the Interest mailing list