Important: Please read the Qt Code of Conduct -

Problem importing .pro file into Visual Studio

  • Hi,
    I have installed the qt visual studio plugin, but when I try to open an existing .pro file over the Qt menu, I get the following error:
    @-- (qmake) : Arguments: -tp vc "" -o "dataTree.vcxproj" QMAKE_INCDIR_QT=$(QTDIR)\include QMAKE_LIBDIR=$(QTDIR)\lib QMAKE_MOC=$(QTDIR)\bin\moc.exe QMAKE_QMAKE=$(QTDIR)\bin\qmake.exe

    [1] - WARNING: (internal):1: Unescaped backslashes are deprecated.
    [2] - WARNING: (internal):1: Unescaped backslashes are deprecated.
    [3] - WARNING: (internal):1: Unescaped backslashes are deprecated.

    --- (Import): Error(s): 3
    --- (qmake) : Exit Code: 0

    --- (Import): Generated project could not be loaded.
    --- (Import): Please look in the output above for errors and warnings.@

    I think the problem is the backslashes within the qmake arguments, but how can I change them to normal slashes in Visual Studio?

  • welcome to devnet

    With Visual Studio you should be able to change the backslashes with replace (ctrl+h). You need to use regular expressions. In the string to change you need to use "\" (double backslashes).

  • Hi, thank you very much for your welcome :)
    Unfortunately, your method does not work on my problem.
    What I am doing is going to the menu item "Qt"->"Open Qt project (.pro) file", then chose the file and all other is executed automatically. So, there is no way to change the backslashes here.
    How can I change the instruction, that the Qt creator executes?

  • I am not aware of a possibility to change a setting for import. However, why you are not opening the .pro file simply with vc as editor. Than you can change the backslashes to forward slashes. Save it and open again through the Qt menu. Beware of the continuation lines. Those require the backslashes at the end of the previous lines.

  • But the problem is not in my .pro file, it does not matter what I write within the file. Even when I open an empty .pro file the backslash problem appears. So, there must be a problem with the importer :/

    What I have done now is, I have used to command line tool to build the .vcxproj file (visual studio project file) manually. Unfortunately, when I double click the visual studio project file, it says that the project file could not be read and I should open it with the visual studio IDE to convert it to the last version, before it can be build by the MSBuild. But how can I convert the project file?? When I chose -> File-> Open->convert , there is no converter available.

  • Apparently you are using msvc 2010 or newer. No experience with that tool. Still using vc2005.

    I would assume that your command line may have generated for an older version. within the first lines you should see something like
    ProjectType="Visual C++"
    Which version is stated in your case?
    You may have to name the file to .vcproj and open with visual studio, but that is a wild guess.

    [quote author="JohnDoes" date="1346224301"]
    How can I change the instruction, that the Qt creator executes?[/quote]

    What do you mean with that?
    Are you trying to use Qt creator or visual studio?
    qmake is used with both.

  • Ok, i have managed to open the import dialog by changing the version from 8.00 to 9.00 and changing the file to .vcproj - thanks for that :)
    Now the project imports, but the Qt libraries can not be found (e.g. #include <QtGui/QApplication>).
    When I create a new Qt project with visual studio, there is no problem with Qt libraries.

    Regarding your second question:
    Sorry, i mean the Qt plugin for visual studio and not Qt creator, I am using visual studio.

  • Try if you can go to "Qt project settings" and there to "Qt modules". You might be able to select the modules you need.
    AFAIK I had problems in the past. In the mean time it is my custom to make my new projects Qt projects in general, even if I am not intending to use Qt in the beginning. I believe I am doing this also because of trouble when trying to add Qt later on.

    However, this is for sure a couple of versions of vsaddin back.

  • Ok, the errors are gone.
    Thank you so much for your help!!!!! :)

Log in to reply