Qt moc error 1 - what does it mean?

I am trying to create a project on Mac OSX and this gives me a cryptic error:

[moc_droparea.cpp] Error 1

droparea.cpp is the (obviously) file in the project. I checked that it exists in the project directory and is not corrupted. The moc_droparea.cpp file moc_droparea.cpp not appear in the build folder after this error, so I assume that it cannot build for any reason, but the error is too vague to help me figure out what is happening. Can someone help me figure out what this means?

+4
source share
4 answers

The solution was annoyingly simple. I had a folder structure that put spaces (illegal characters) in the file path. I put underscores instead of spaces, and it built perfectly. I would have thought that the moc pre-processor might handle spaces in file names, but apparently not. I feel stupid, but at least the problem is solved now.

Hope this solution can help someone else.

+4
source

Click Compile Output, scroll up and click the red line.

In my case, the red line said: you cannot define an integer value in closed slots.

In the qt creator’s window, under the “Progress Information” section, there is a button with the name “Compile Output” (button number 4). Errors are explained there in red. Click it and scroll up.

+2
source

This could be due to many things that I think I had a similar situation when I forgot to delete the entry in the .qrc file that no longer existed.

So, check also the resource paths.

0
source

The same error 1 occurred due to a ressource (.qrc) file that referenced a file name starting with a period. When I removed the period from the file name, the compilation worked again. Interestingly, the error only occurred on Mac OSX using the Clang compiler. On Windows, using the gcc compiler, the file name did not cause an error.

Perhaps the message "[source file name] 1" generally means that the file was not found due to unexpected characters in the file path.

0
source

All Articles