how to fix these build errors(msvc2019 64bit)
-
wrote on 14 Apr 2023, 01:54 last edited by
-
I'm new to QT. i just installed the c++ development tool from VS and Microsoft Visual C++ 2015-2019 Redistributable (X64). QT indicate that i have correct kit. However, some mistakes happen when i build files. Here's the screenshot.
@victor_wen , as you said the compiler/toolchain setup looks correct. You could verify this by compiling and linking a simple hello world program, e.g. created by a project wizard.
The warnings and errors you see seem to stem from the project you have opened though, which seems not compatible with MSVC; the very first warning indicates that you have for instance a
#pragma GCC
in the sources that the MSVC compiler doesn't know. So I suggest either to select a MinGW kti (like the Desktop Qt 5.15.2 MinGW 64-bit you have), or fix the sources to be compatible with MSVC. How to do this very much depends on the project at hand.
-
@victor_wen , as you said the compiler/toolchain setup looks correct. You could verify this by compiling and linking a simple hello world program, e.g. created by a project wizard.
The warnings and errors you see seem to stem from the project you have opened though, which seems not compatible with MSVC; the very first warning indicates that you have for instance a
#pragma GCC
in the sources that the MSVC compiler doesn't know. So I suggest either to select a MinGW kti (like the Desktop Qt 5.15.2 MinGW 64-bit you have), or fix the sources to be compatible with MSVC. How to do this very much depends on the project at hand.
wrote on 14 Apr 2023, 08:51 last edited by@kkoehne Thanks for your advice. I can't use MinGW because of the request of project. besides, I have tried the example in QT. What confuses me most is the errors are exactly the same as the errors when I don't get correct MSVC kit. I thought it might be that
I have installed and uninstalled it for several times. Is there the possibility of it? How can I do to solve this? -
@kkoehne Thanks for your advice. I can't use MinGW because of the request of project. besides, I have tried the example in QT. What confuses me most is the errors are exactly the same as the errors when I don't get correct MSVC kit. I thought it might be that
I have installed and uninstalled it for several times. Is there the possibility of it? How can I do to solve this?@victor_wen , can you show the full warning / error, including compiler line?
It looks like you're using MinGW headers with MSVC. Do you have by chance set the environment variable INCLUDE manually?
-
-
wrote on 20 Apr 2023, 02:02 last edited by
I pasted the error messages into text. Here is the link of it [link text](https://kdocs.cn/l/ckfwRT42MWw1?f=201
[文件]error.docx).Besides, I didn't modify the environment variable by chance. -
I pasted the error messages into text. Here is the link of it [link text](https://kdocs.cn/l/ckfwRT42MWw1?f=201
[文件]error.docx).Besides, I didn't modify the environment variable by chance.@victor_wen You're uploading error messages as Word document?!
Why don't you simply post them here as plain text? -
@victor_wen You're uploading error messages as Word document?!
Why don't you simply post them here as plain text?@victor_wen , indeed, feel free to just post short snippets here , or use plain-text code sharing services like https://pastebin.com/ .
Anyway:
D:\include\stdint.h
a) Having a top level include in D: is ... unusual. Did you place it there? Or do you do some magic with virtual drive folders? Where is the actual code you compile?
b) Why does MSVC look into D:\include? Provided that you don't have any source files in D:\ itself, is INCLUDEDIR is set in your environment, or does your build system (CMakeList.txt, .pro file, Visual Studio solution) somehow explicitly add D:\include to the include directories to be searched by the compiler? -
@kkoehne Thanks for your advice. I can't use MinGW because of the request of project. besides, I have tried the example in QT. What confuses me most is the errors are exactly the same as the errors when I don't get correct MSVC kit. I thought it might be that
I have installed and uninstalled it for several times. Is there the possibility of it? How can I do to solve this?wrote on 20 Apr 2023, 20:16 last edited by@victor_wen Can you click the Desktop Qt 5.15.2 MSVC 2015 or 2019 64bit to check if the Compiler selection is correct.? After mouse click, the selection will be showed. Post the picture here.
-
@victor_wen , indeed, feel free to just post short snippets here , or use plain-text code sharing services like https://pastebin.com/ .
Anyway:
D:\include\stdint.h
a) Having a top level include in D: is ... unusual. Did you place it there? Or do you do some magic with virtual drive folders? Where is the actual code you compile?
b) Why does MSVC look into D:\include? Provided that you don't have any source files in D:\ itself, is INCLUDEDIR is set in your environment, or does your build system (CMakeList.txt, .pro file, Visual Studio solution) somehow explicitly add D:\include to the include directories to be searched by the compiler?wrote on 22 Apr 2023, 10:12 last edited by@kkoehne thank you. The include folder confused qt, it turns
good after I delete this folder. -
@kkoehne thank you. The include folder confused qt, it turns
good after I delete this folder.Great. Feel free to 'resolve' this topic then.
-
-
-
-
-
1/10