C++ “没有为 Win32 平台分配给这个项目的 Qt 版本” - Qt 的 Visual Studio 插件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10452721/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 14:04:49  来源:igfitidea点击:

"There's no Qt version assigned to this project for platform Win32" - visual studio plugin for Qt

c++visual-studio-2010qt

提问by zebra

I have a Qt project I am working on in Visual Studio 2010, with the Qt Visual Studio Add-in (for Qt 4.8). The project is running fine on my work machine, and I am trying to run it on my home machine. When I try to build, I get the following error:

我有一个 Qt 项目,我正在 Visual Studio 2010 中使用 Qt Visual Studio 插件(适用于 Qt 4.8)。该项目在我的工作机器上运行良好,我正在尝试在我的家用机器上运行它。当我尝试构建时,出现以下错误:

There's no Qt version assigned to this project for platform Win32.

Please use the 'change Qt version' feature and choose a valid Qt version for this platform.

没有为 Win32 平台分配给该项目的 Qt 版本。

请使用“更改 Qt 版本”功能并为此平台选择一个有效的 Qt 版本。

However, it's set up to use a valid Qt version (another project I'm working on at home uses this plugin as well). Why is this occurring? When I got to Qt -> Qt Options, I see a valid version (4.8.0). Thanks

但是,它被设置为使用有效的 Qt 版本(我在家工作的另一个项目也使用这个插件)。为什么会出现这种情况?当我进入 Qt -> Qt Options 时,我看到了一个有效版本 (4.8.0)。谢谢

回答by Fabian

Did you select a proper Qt version in the Qt settings of your project?

您是否在项目的 Qt 设置中选择了合适的 Qt 版本?

More detailed: If you right-click on the project there should be a "Qt Project Settings" option (or similar - I use the german version) near the end of the context menu. In there you can set the Qt version that this specific project uses. Is this one possibly not set correctly?

更详细:如果您右键单击该项目,则上下文菜单末尾附近应该有一个“ Qt 项目设置”选项(或类似的 - 我使用德语版本)。在那里你可以设置这个特定项目使用的 Qt 版本。这个可能设置不正确吗?

回答by helsinki

Solution:

解决方案:

  1. Right click your project;
  2. Qt Project Settings;
  3. Under the Propertiestab, you will find the option Version;
  4. change it to a proper value;
  1. 右键单击您的项目;
  2. Qt 项目设置
  3. Properties选项卡下,您将找到选项Version
  4. 将其更改为适当的值;

Now, go ahead with your project.

现在,继续您的项目。

Hope to help

希望有所帮助

回答by Igor R.

Open vcxproj file in a notepad, look for QtVersion...something=... Ensure that the version value is really 4.8.0 (or whatever is your actual QT SDK version).

在记事本中打开 vcxproj 文件,查找 QtVersion...something=... 确保版本值确实是 4.8.0(或任何您实际的 QT SDK 版本)。

回答by snake_xy

I found this issue too. and I found the solution . you must keep the Qt version name is exactly same with the project create using. which you think u can change freely,but actually not.

我也发现了这个问题。我找到了解决方案。您必须保持 Qt 版本名称与使用的项目创建完全相同。你认为你可以自由改变,但实际上不是。

回答by Batox

If you want to move Qt project between different computers, it's a good idea to use the qt project file, and not the MSVC (.vcxproj) one. So when you move from your work machine home, create a .pro file (in the Qt menu, you find the neccessary options to do that), and then load the .pro file at home, again using the Qt menu inside MSVC.

如果您想在不同计算机之间移动 Qt 项目,最好使用 qt 项目文件,而不是 MSVC (.vcxproj) 文件。因此,当您从工作机器搬回家时,创建一个 .pro 文件(在 Qt 菜单中,您可以找到执行此操作的必要选项),然后在家中加载 .pro 文件,再次使用 MSVC 中的 Qt 菜单。

回答by David Casper

Another thing this could be is the platform being used is not the platform you think it is. In MSVC right-click on project, select properties, and then press configuration manager. Then check that all configurations and platforms are as you expect them to be.

另一件事可能是正在使用的平台不是您认为的平台。在 MSVC 中右键单击项目,选择属性,然后按配置管理器。然后检查所有配置和平台是否符合您的预期。

回答by Dmytro Hnatiuk

I got the same problem during migration from Qt5.9 to Qt5.10. We have a solution (Visual Studio) which consists of many projects. Some of them have QtVersion = "Qt5.9" and others have QtVersion = "Qt5.7" (yes, it were inaccurate project settings)

我在从 Qt5.9 迁移到 Qt5.10 的过程中遇到了同样的问题。我们有一个由许多项目组成的解决方案(Visual Studio)。其中一些有 QtVersion = "Qt5.9" 而其他有 QtVersion = "Qt5.7"(是的,这是不准确的项目设置)

So, after I change all Qt project's settings from 5.9 to 5.10 automatically and remove Qt5.7 from versions list - I got the same error. This error was fixed trivially - I just add back Qt5.7 to the versions list (temporary until ALL projects' Qt version was not changed to 5.10).

因此,在我自动将所有 Qt 项目的设置从 5.9 更改为 5.10 并从版本列表中删除 Qt5.7 之后 - 我遇到了同样的错误。这个错误很简单 - 我只是将 Qt5.7 添加回版本列表(暂时直到所有项目的 Qt 版本没有更改为 5.10)。