PDA

View Full Version : Error C1083 in Visual Studio 2013, compiler can't open Moc file



coopster
3rd March 2016, 15:41
Hi All

I'm trying to compile a project in VS 2013. I'm using the 32 bit 2013 Qt version and have generated a .pro file automatically using Qt VS Add-in. I'm getting the C1083 error- the compiler can't open the moc file. This is the contents of the .pro;


TEMPLATE = app
TARGET = Shot_Manager
DESTDIR = ../Win32/Debug
QT += core widgets gui
CONFIG += debug
DEFINES += WIN64 QT_DLL QT_WIDGETS_LIB
INCLUDEPATH += ./GeneratedFiles \
. \
./GeneratedFiles/Debug
DEPENDPATH += .
MOC_DIR += ./GeneratedFiles/debug
OBJECTS_DIR += debug
UI_DIR += ./GeneratedFiles
RCC_DIR += ./GeneratedFiles
include(Shot_Manager.pri)

Anyone know what I'm doing wrong? I can see the moc files in solution explorer and they appear to be in the path specified in the MOC_DIR...

Thanks

d_stranz
3rd March 2016, 19:39
Are you building from within the VS IDE, from the command line, or using Qt Creator? If you are building from within VS IDE, then you have no need for a .pro file. Visual Studio creates a VS solution and project for you. If you are building from the command line, then you probably need to run qmake again. Likewise for Qt Creator.

coopster
4th March 2016, 08:39
Are you building from within the VS IDE, from the command line, or using Qt Creator? If you are building from within VS IDE, then you have no need for a .pro file. Visual Studio creates a VS solution and project for you. If you are building from the command line, then you probably need to run qmake again. Likewise for Qt Creator.

I'm building from within the VS IDE. Ok, I'll delete the .pro file. I only created that in an attempt to fix this problem. Do you know how I can fix for VS IDE build? Thanks

d_stranz
5th March 2016, 19:56
Isn't there an item on the Qt Add-in menu for "Convert to Qt project" or something like that?

At worst, you can back up your files somewhere, delete the project (in VS and manually), and re-create it. If you add classes with exactly the same names as your old project, you can copy the old files over top of the new ones and it should all work. You can also create the project, copy the files into the project directory, then use the "Add -> existing item" command from the right-click on the Solution browser to add the copied files into the project. As long as you be sure to create it as a Qt project, it should all work.

Don't add anything that is auto-generated (like moc files). For Qt GUI classes, just add the .cpp, .h, and .ui files. For QObject classes, just the .cpp and .h.