Qt <codecvt> : No such file directory - c++

I cant use std::wstring_convert in Qt 5.1, because it said me that <codecvt> : No such file directory. What can I do? I don't know... this code is working at the MSVC 2013.

QtCreator is just a front-end that allows you to edit your source files, it does not contain a compiler. On Windows you need either MinGW or Visual Studio to compile code.
If you want to use Qt 5.1 with Visual Studio 2013, you would have to compile Qt yourself. Digia provides builds for Visual Studio 2010 and 2012. You can find the latest version of Qt here or an old release here.
My advice would be to install Visual Studio 2012 and download a VS2012 build of Qt. Then go to Tools > Options > Build & Run > Kits, click the Add button on the right (or modify the existing one as it probably won't work anyway). Set the compiler to "Microsoft Visual C++ compiler 11.0 (amd64)" if you downloaded the 64 bit version of Qt or "(x86)" if you downloaded the 32 bit version.
Then set the debugger to cdb.exe and the Qt version to the one you just downloaded (if you don't see it, go to the Qt Versions tab at the top, add it, click Apply and the go back to Kits and it should be there). Click ok and your kit should be ready! Make sure that you don't have a warning signal that would point out a potential mistake.
Now open your project and go to the Projects tab (Ctrl + 5) and make sure your project is using the correct Kit.
You should now be all set up properly.
Additionally, if you don't want to install Visual Studio 2012 and want (or have to) work with VS 2013, you can use the Qt 5.3 BETA builds located here. Please note that these builds are in beta and shouldn't be used in production code, if you want to use VS2013 with Qt in production code I would recommend to build Qt 5.2.1 with VS2013, it's not that hard but it can take a while.

You are missing this in your project file:
CONFIG += c++11
You need to make sure that your GCC version (brought to you by mingw) supports that feature though. It is possible that you are using an old version where it was not supported.

Related

Qt VS Tools: error reading VS project settings

I develop an application using Visual Studio 2015 + Qt VS Tools extension. For me it's first time I used Qt (version 5.14.1) in my project. Everything was working fine until something wrong happened.
I was asked to make release version of my application, it worked fine on Windows 10 and Windows 7 64-bit systems. Then I set the project configuration back to Debug x64 to continue my work. First strange thing I noticed - when I double-clicked on *.ui form files in my Solution Explorer, Visual Studio crashed and reloaded without any error, Qt Designer doesn't launch.
What I tried:
First I tried to open Qt Designer externally (from bin folder in Qt directory) and open my form - it worked.
I tried another project made in VS 2015 + Qt VS Tools Extension - same problem.
I tried to remove my Qt Version and re-add it. And here it comes: Error screenshot. It also occurs without using system enviroment variable $(QTDIR).
I reinstalled Qt to my PC (installed version 5.14.2 instead of 5.14.1), same error.
I reinstalled Visual Studio 2015, same error.
I tried to reset my Visual Studio settings and parameters to default, no results.
I installed Visual Studio 2019. The problem is still present.
UPD:
I cleared Visual Studio cache according to these instructions. It didn't work for me.
I removed every Visual C++ Redistributables from my PC and installed the latest version from Microsoft site. It also didn't work.
The error occurs even if no project is opened, so the problem is caused either by Visual Studio 2015, by Qt 5.14, or by Qt VS Tools extension.
P.S. Sorry if my english wasn't perfect. Waiting for any ideas on fixing this problem.
For any future readers who have this problem, start your maintenance tool or Qt installer, e.g. C:\Qt\MaintenanceTool.exe, "Add or remove components", and then make sure Qt/<version>/MSVC is installed, as shown in the image below:
.
Then you'll be able to select that Qt version instead of MinGW, since the Visual Studio extension only supports the MSVC compiler and not MinGW.
Encountered the exact same problem and the only solution I have found was reverting to an older version of the Qt Visual Studio Tools extension.
Visual Studio has been painfully persistent about updating the version even once I installed an older one, so make sure to disable automatic extension updates (Extensions → Manage Extensions → Extension Settings → Uncheck Automatically search for updates/Automatically update extensions).
Hope it helps.
To solve your problem, you need to remove the QTDIR and QMAKESPEC environment variables that remain in Windows after installing older versions of Qt.
Well, after some more procedures that didn't help, I just did clean-reinstallation for my Windows 10. Fortunately, that helped :)

Unable to create "Qt Gui Application" with Visual Studio 2010 and Qt version 4.8.0

I am building a GUI application in which I have to use Visual Studio 2010 build tools. I was told that the correct qt version to use with this VS version is 4.8. I've downloaded Qt 4.8.0 using this link:
https://download.qt.io/archive/qt/4.8/4.8.0/
And I made this version the default in the VS Qt options menu. However, when I try to create a new visual studio project, all of the module options are greyed out.
Which in turn makes it impossible to create the project because upon clicking "next", the "Finish" button is also greyed out. Any Idea of what's going on??
With pre-compiled binaries (that is, you don't have to compile qt yourself) you can use Qt 5.5.1 with VS2010 that you can get from here.
After that, i would create a simple project using qmake and specifying
TEMPLATE = VCAPP
that will tell the qmake (see docs) to generate a .vcprojx file that you can use from VS2010.
Latest Qt version that supports VS2010 is 5.6.3 IIRC, however mind you that even that version is now EOL. (March 2019).
You should try to upgrade to 5.9 or 5.12 (however i am not sure that VS2010 will be able to support those since they rely pretty heavily on c++11 that VS2010 supported very lightly)
P.S. If you'r stuck with Qt4 then greatest version is 4.8.7 (VS2010 supported) that you could get from here

Installing Qt 5.5 on Windows 7

I would like to install latest version of Qt (5.5) on Windows 7 for C/C++ application development, and have a few questions:
Can I use Microsoft "Visual Studio Community" edition (2015) as the compiler?
I assume I need to install Visual studio first and then Qt?
I am going to install Qt from here, after downloading and installation do I need to build Qt? Or it is ready to go?
Is there a tutorial that explains all the required steps in details. I have done Google search and found bits and pieces here and there not not a good complete step-by-step reference.
Thanks for the help.
You need the compiler, which is integrated in visual studio. I don't think you can get the newer ones without Visual Studio (From official sources). However, you can use Qt on windows without msvc. You can build with the minGw compiler - but I personally like msvc more.
Regarding VS2015: It won't work without extra configuration. Qt 5.5 supports msvc2013 only (the next release, 5.6, will support the msvc2015 compiler). But Visual Studio 2013 will work. The order of installation doesn't matter.
After you installed Qt, all you need to do is launch Qt-Creator and start coding ;) If you wan't to use Visual Studio instead, there is a Plugin on the bottom of the download page ("Other downloads"). Visual Studio 2015 isn't supported here too, but 2013 is.

Which Qt to download?

I am new to C++ and have been working with MS VISUAL STUDIO 2010 Express. However, I am in need to shift to Qt as my university recommends. Unfortunately, the qt.nokia.com is redirecting to another site http://qt.digia.com/.
Since everything in that site is not free, I found the following link called "Qt Open Source Version". Is this is the site to download Qt?
When I go there, I can see various options, which means number of downloads. I have windows 7 ultimate and got visual studio 2010 express installed in my machine. But, this site got number of windows downloads. I prefer the one which claims to come with the Qt IDE (Qt Creator??). If you need further more information, I will be using this Qt GUI C++ applications with OpenCV.
I have already installed OpenCV and it works with VS so if you can, please tell me how to set it up with Qt as well.
Please help me to download the correct version of Qt. Thanks
Answering to these kind of question is always hard and dangerous!
I know you had experiences with VS but
I'm going to offer you to choose MinGW instead.
Download link
qt-project is the correct place to get open source Qt.
There are prebuilt binaries of Qt 5.0 for VS2012, but if you want to use Qt 4.8 with VS2012 you'll need to compile it yourself, as there are no prebuilt binaries for VS2012 (yet?). Compiling Qt is not difficult, just open command prompt for VS2012, run configure --help to find out how you can customize your Qt build. Then run configure with appropriate parameters, then nmake.
If you decide to use Qt Creator as an IDE you are welcome to do it - Qt Creator can compile projects using different compilers, including VS2012 compiler. But in order to debug projects compiled with VS2012 compiler you'll either need to use VS2012 or install Debugging Tools for Windows (which Qt Creator will find and use to debug VS2012-generated executables).
http://qt-project.org/downloads
Qt 5.0
Select the file according to your operating system from the list below to get the latest Qt 5.0 for your computer. The binary packages include Qt 5.0.2 libraries and Qt Creator 2.7.0
Qt 5.0.2 for Windows 32-bit (VS 2010, 485 MB)

How do I configure Qt to work with Visual Studio 2010?

I downloaded open-source version of Qt from the site and have compiled it with nmake, but I'm having trouble using it in my projects. It seems that Visual Studio can't find the Qt headers, even though I added the paths to my PATH, INCLUDE, and LIB variables. I tried installing the Qt Visual Studio add-in but it only supports Visual Studio 2008.
Has anyone gotten Qt to work with Visual Studio 2010? Or do I have to wait until Qt 4.7 is officially released for Visual Studio 2010 support?
Either download the pre-built vs2008 package or build it using cmake's vs2008 profile and then open the resulting .sln file in vs2010 and let it do the conversion.
edit - annoying feature so far is that the vs plugin doesn't support vs2010 which makes it essentially impossible to use for desktop app development.
Traditionally VS support was part of the paid licences, with the OS package you only get mingw support. Things are changing, but might have some rough edges for a while.
OTOH, mingw has a HUGE advantage: deployment. You don't have to chase around the vcredist_x86 files and all the associated voodoo. Just be sure to include all the .DLLs you use and that's it.
Also, there's QtCreator. It's not as featureful or omniscient as VS; but it does feel a lot nicer and easier to use. It takes off all the tedious work of nmake, and embeds the UI editors. And it's cross platform!
honestly, for me VS can drop dead this minute and i won't miss it.
Qt V4.8.0 contains prebuilt binaries for Visual Studio 2010 so you don't need to build manually anymore:
http://qt.nokia.com/downloads/windows-cpp-vs2010