1

With QMake, the setup for QtScript is as simple as adding this to your .pro file:

QT += script

But we'e using MS Visual Studio for the project. What do I change to make Visual Studio recognize includes for QtScript? Currently, it reports that the files were not found:

#include <QScriptEngine>
#include <QScriptValue>

fatal error C1083: Cannot open include file: 'QScriptValue': No such file or directory

I use the Qt add-in for visual studio. I have checked the script option there - well actually it was checked already - but that didn't solve the problem:

image description

Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
  • use the vs addin that will set the paths for you; else you will need to set your additional include paths, additional library paths and additional dependencies for the QtScript module – Zaiborg May 24 '16 at 11:20
  • @Zaiborg I have the add-in. In the project settings, I have checked "*Script*" entry. That has no effect. – Tomáš Zato May 24 '16 at 11:38

2 Answers2

1

I tried like you, same error. Then I tried to include like this:

#include <QtScript/QScriptValue>

And it worked. I tried this again :

#include <QScriptValue>

And now it works.

IAmInPLS
  • 4,051
  • 4
  • 24
  • 57
  • Thanks for the reply, but that doesn't seem so far to work: `Cannot open include file: 'QtScript/QScriptEngine': No such file or directory`. I will try to clean and rebuild, but I think it won't help. – Tomáš Zato May 24 '16 at 12:15
  • Weird... Did you include the QtScript directory in `Additional Include Directories` under your project properties? – IAmInPLS May 24 '16 at 12:17
-1

I guess it is something similar to what is explained in this link,

To summarize,

Configuration properties: General Character Set: Use Unicode Character Set

C/C++: General Additional Include Directories: "QT include directory here".

Linker: General Additional Library Directories: "QT Lib directory here".

Linker: Input Additional Dependencies: Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib (the import libraries for the required Qt DLLs) (Add subscript d for debug mode ...)