Warm tip: This article is reproduced from stackoverflow.com, please click
QT qt-creator

Qt moc error 1

发布于 2020-03-28 23:15:54

I'm trying to build a project on Mac OSX, and it's giving me a cryptic error:

[moc_droparea.cpp] Error 1

droparea.cpp is (obviously) a file in the project. I checked that it exists in the project directory and is not corrupted. The file moc_droparea.cpp doesn't show up in the build folder after this error, so I'm assuming it's failing to build for whatever reason, but the error is too vague to help me figure out what's going on. Could anyone help me figure out what this means please?

Questioner
CoutPotato
Viewed
70
CoutPotato 2010-08-26 03:24

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 fine. I would think the moc pre-processor could handle spaces in file names, but apparently not. I feel foolish, but at least the problem is solved now.

Hopefully this solution can help someone else.