简体   繁体   中英

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 :

  1. Deleted the whole project and its folder completely.
  2. Created the project anew.
  3. 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.
  4. Then I ran VS2013 x64 Native Tools Command Prompt .
  5. Switched to the project folder.
  6. 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:

  1. 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.
  2. 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.
  3. If any error happened during one compiling, another qmake must be executed in next attemption.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM