0

Is there way to force recompile other projects moc file? I use visual studio, and I got one qt project, where I added other project class with interface and signals/slots (let say thing.cpp, thing.h,

ui_thing.h(has been included generated files folder),

moc_thing.cpp in generated files\debug (because of main projects is in debug mode),

and thing.ui into Form files)

It was working ok until I decided made some changes, add some slot/signals stuff. As you can guess included moc file does not recompiles. I decided to change some properties of the thing.h .

I copied parameters from the main projects files so In the command line part there is

"$(QTDIR)\bin\moc.exe" "$(InputPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB -DQWT3D_DLL -DQT_DLL -DQT_SVG_LIB -DQT_SCRIPT_LIB -DQT_MULTIMEDIA_LIB "-I.\parsers" "-I$(QWTDIR)\include" "-I.\ProductionHistory\GeneratedFiles" "-I.\ProductionHistory" "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtSql" "-I$(QTDIR)\include\QtGui" "-I." "-I$(Boost)\." "-I.\well groups widget" "-I.\rules widget" "-I.\gui" "-I$(QTDIR)\include\QtSvg" "-I$(QTDIR)\include\QtScript" "-I$(QTDIR)\include\ActiveQt" "-I$(QTDIR)\include\QtMultimedia"

In the output data part ".\databaseOpening\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp"

In the additional dependencies part there is "$(QTDIR)\bin\moc.exe"; $(InputPath)

But it still not recompiles. Is there way to solve this problem?

DanilGholtsman
  • 2,354
  • 4
  • 38
  • 69
  • 1
    What if in additional dependencies do this: `"$(QTDIR)\bin\moc.exe";$(InputPath)`? Please note that there is a **semicolumn** between values, and not a space. – vahancho Feb 06 '14 at 09:04
  • @vahancho well, seems like it not helped, but thx I edited the question – DanilGholtsman Feb 06 '14 at 09:07
  • You can use Qt Visual studio addin – Dmitry Sazonov Feb 06 '14 at 09:29
  • @DmitrySazonov what do you mean by that? also, I got some problems with it - I cant even add new Qtclass into the main project beacuse of `It is impossible to add a QtGuiClass to the current project, as it was not created using Qt5VSAddin.` – DanilGholtsman Feb 06 '14 at 09:40
  • You should create project as Qt project - then this features (including your original question) will be enabled. – Dmitry Sazonov Feb 06 '14 at 10:28
  • @DmitrySazonov seems like converting into qt add in project didn't help too – DanilGholtsman Feb 06 '14 at 10:56
  • well, I reinstalled the QtAdd-in utility and just made new QtGui class in the main project where I copied code(of the `thing` class) from the other project, it helped me. but actually it's not a good way to solve such problems I think – DanilGholtsman Feb 07 '14 at 08:25

1 Answers1

1

Try check/fix project file *.vcxproj

  1. add Keyword in section PropertyGroup Label="Globals"
<PropertyGroup Label="Globals">
   <ProjectGuid>....
   <RootNamespace>...
   <Keyword>Qt4VSv1.0</Keyword> <-----------------
</PropertyGroup>
  1. Check ProjectExtensions/VisualStudio/UserProperties section the attribute Qt5Version_x0020_Win32 ( >>Qt5...)
 <ProjectExtensions>
    <VisualStudio>
      <UserProperties MocDir=".\GeneratedFiles\$(ConfigurationName)" 
         Qt5Version_x0020_Win32="$(DefaultQtVersion)"  <-------
         UicDir=".\GeneratedFiles" />
    </VisualStudio>
  </ProjectExtensions>
Brom
  • 11
  • 1