Qt Creator build error with under Windows - c++

I want to port a multiple project MSVS solution to Qt Creator.
I created the .pro files for the projects and added them to Qt Creator.
When I build the projects I always get the same error shown below.
By the way I am using Qt 4.6.3 (VS 2008). What may cause this?

It's difficult to say what the problem is frmo the jom.exe output.
It might be that the command it's trying to execute on the console is too long (MS reference).
A similar problem was reported here, although is not clear if it was solved.
I suggest you upgrade to a more recent version of Qt and try again (sorry).

You could change your make step from jom to nmake (found in the projects window) to see if it gives you a more detailed error.
It also seems that you do not have any source code files in your project, just your library's header files.

Related

Qt command error when nmake the odbc files

I'm new for C++ and Qt.
Recently, I was learning Qt with MS SQl, but I met a problem when compiling the odbc files.
Firstly I run qmake and it goes well. But when I use nmake, the following errors happened:
module machine type 'x64' conflicts with target machine type 'x86'
I encountered similar problem just today.
Same as you,
I tried almost all comand tools include the one in qt, vs2015 x86,x64
command prompt, and cross tools as well. But none of them works.
I solved the problem by the following:
Deleted the whole project and its folder completely.
Created the project anew.
Made sure %PATH% variable, aside from irrelevant paths, contained only path to proper Qt build. In my case %PATH% contained 'C:\Qt\5.5\msvc2013_64\bin'. By proper i mean, of course, a Qt build that was built using the same compiler I was trying to compile with.
Then I ran VS2013 x64 Native Tools Command Prompt.
Switched to the project folder.
Then i did qmake and then nmake and it was all OK.
I think the problem was that, as drescherjm suggested,
If you tried one time with the wrong command prompt then tried again on the same build folder you build folder would have been broken by the bad try.
and therefore,
You will have to clean build between tries.
Thanks to drescherjm and Herman Nurlygayanov, the problem is finally solved.
Here is some experience I get from this problem:
The version of Qt creator whether 32-bit or 64-bit should be made sure before all these stuff by checking the About Qt creator. It is important to choose the right version of command prompt before compiling.
Besides, If a 32-bit command prompt is used, then vcvars32.bat should be executed. As for 64-bit version, vcvarsall.bat should be executed. They are located in %dir of you vs%/vc and %dir of you vs/vc/bin respectively.
If any error happened during one compiling, another qmake must be executed in next attemption.

compiling Qt using nmake gives Command line error D8021 : invalid numeric argument ‘/FS’

I’m trying to deploy my Qt application to windows and I’m getting an error when I run nmake about /FS being an invalid numeric argument. It looks like it’s some kind of compile flag that’s not being recognized by the compiler. I have no idea on how to fix this and there doesn’t seem to be any information than what's already provided here http://qt-project.org/doc/qt-5/windows-deployment.html.
I posted my original question here Deploying a Qt 5.3 App on Windows
This person has the same problem Deploying a 32-bit Qt 5.3.0 app (Stand-Alone)
I’m on Qt 5.3 with Visual Studio 2013. As both question shows it seems to be running cl and nmake from VS 2010. I’m going to bet this is where the problem lies
Thanks for any help with this problem
Use cl.exe version 18.x to compile.
Had the same problem and it was me calling the wrong vcvars32.bat from qtenv2.bat, basically was using MSVC2010 with Qt for MSVC2013
As edwinc mentioned, compiler version should be 18.x
Qt 5.4.1, VS 2013. Fixed the issue by editing
C:\Qt\Qt5.4.1\5.4\msvc2013_64\mkspecs\win32-msvc2013\
removing faulty parameter from
QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t
I ran into this same problem trying to compile the deprecated QtHttp and QtFtp modules for Qt5. You're right that the cause of the problem is a mismatch in MSVC compiler versions. Here are some of the things I found out for others encountering this:
qmake is going to pull in the mkspecs from qtbase. So if you built Qt with one compiler and try to compile an individual module using a VS command prompt from a different version, it won't care that you used the correct vsvars bat.
qmake can be passed the -spec flag to force it to use a given spec. E.g. qmake -spec win32-msvc2010.
Compiling Qt with one compiler version and your app with another will probably compile and link fine. Then it will crash or fail to start when you try and run it, at best. Worst case, you'll get weird subtle bugs at runtime.
If you had multiple Qt Kits installed, potentially due to running multiple Qt Creators, switching between kits could lead to such problems. Be meticulous in ensuring that you're using the right Qt Kit and, if it's an auto detected kit, then you're using the right Qt Creator.
With your project opened, review your kit:
Options > Build & Run
Select Kits tab
Ensure your kit is selected
In addition consider clicking on "Make Default" to set it as your default kit
That kit should now appear in italic bold
Do a QMake follow by a Rebuild
Did you try compiling with VS itself? Does it work?
Anyway, try checking C1.dll in your C:/windows/... folder (try searching the directories below it), is it an old one which being created like, 5 years ago? If so, you may want to replace it with a newer version such as those included inside your VS2013 folder.

Create First Project in QtCreator, problems with kits

I've just switched to QtCreator for C and C++ developing. I have problem in creating first project, in particular with compiler kits I suppose.
When I go to create a new project, I have the error message that no kits is available.
As you can see, I don't know why it is shown that Qt Version is invalid. How could I solve?
You should first install your C++ compiler. You should also define your compiler in "Compilers" section. If you also want to use Qt you should set the compiler for your kit in the "Kits" section.
When you install QtCreator on MAC OS X you can find it in
/applications/qt
in this folder there is another folder called
5.2.1
Here there are all the compilers.
So to solve the issue you can either add, in QtCreator options, the path of every qmake.bin file or cut the 5.2.1 folder and paste in
/Users/YOURNAME/qt
creating qt folder if it doesn't exist.
PS: I've tried to make the directory invisible, but if I do so, I get errors using the second method

How to configure qt creator to show C++ code rather than disassembler?

Yesterday I had done a lot of things like updating GCC, Clang and reinstalling Qt Creator.Today when debugging my code step by step, the debugger was showing the disassembley rather than the C++ code I wrote. Pressing F10 or F11, the debugger was moving into assembly code not the .cpp nor .h files I wrote. F11 can only go into the library files but never into the files I wrote.
The arrow appeared in disassembler:
Rather than in main.cpp:
How can I configure Qt Creator such that the debugging arrow tracks each line in the C++ code?
For others who also had this problem but none of the solutions above worked (like me), I found out that the issue for me was simply happening because my project was inside of a directory with special characters (/home/fabio/criação/project) the criação folder seems to have caused the problem. After I changed to /home/fabio/Desktop/project it stop happening.
I ran into a very similar problem debugging code built with the clang toolset in qtcreator, and this answer fixed me up:
gdb doesn't find source files compiled by clang++
You can quickly check if that solution will work for you by navigating to the root of your solution in a shell window and then invoking qtcreator from there...set a break point in main() and try debugging - if it stops and shows source in main.cpp, it's quite likely this is the problem.
If that does work for you, there are probably several better ways to implement the permanent solution suggested by https://stackoverflow.com/users/1632219/rene, but the method that worked for me was to modify my qmake mkspec file for the clang toolset. On my system, it lives in /usr/local/Trolltech/Qt-4.8.5/mkspecs/common/clang.conf, so all I had to do was put a clang invoker script with 'clang++ "$#"' in ~/bin/clang-compile and then set QMAKE_CXX in the mkspec to clang-compile. With that change, when the clang toolset is selected, qmake builds make files that use clang-compile instead of clang++ and then debugging works everywhere.
At last, I found that it was Clang that had caused this problem. After changed the kit back to using gcc, it just worked fine. But not sure whether it's Clang's fault or that the script Qt produced for compiling has any problem. Anyway just put the answer here in case anyone else who might encounter the same situation.
Goto "Help->About Plugins" and check the "ClangCodeModel" and restart QT.
There is a bug in version Qt 5.6.1 (MSVC 2013, 32 bit) QT Creator4.0.3.
In debug mode put your breakpoint. Then hit the step into(F11) it will start debugging now. To go to your code hit the step-over(F10) until you come to the code page.
I have searched about this problem but nothing worked. Some solution, i didn't get.
This is very annoying issue.
Maybe it will work if you clean, qmake and rebuild.I solved this problem by using this method.

I cannot build and run a simple Qt 5 application,

I downloaded and installed Qt 5 on Windows 7.
I opened QtCreator 2.6.1 and created a new simple GUI application.
When I try to run it, it says:
“C:\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtCore\qglobal.h:46: error:
C1083: Cannot open include file: ‘stddef.h’: No such file or
directory”
What is the problem and how do I solve it?
My compiler is: MSVC2010 32 bit
A google search yielded the following:
http://qt-project.org/forums/viewthread/10255
This thread notes that this error happens when you don't have the Microsoft Platform SDK installed and you are using Visual Studio. That would make sense considering that stddef.h is one of the standard headers (usually its included using <cstddef>, but looking at the source for qtcore/global.h it would seem that it is indeed included as <stddef.h>). So, try installing the platform SDK if it isn't already there.
If you already do have the sdk, perhaps it isn't configured properly. This answer says you need to follow the instructions given by microsoft here to do command line builds properly. I think Qt Creator probably executes the compiler from the command line, so that may help.
If that still doesn't work, try installing the MinGW compiler and using that. I have seen a few references saying that its easier to compile for Qt under windows using MinGW.