首页 > 解决方案 > 如何使用不同的 Visual Studio 版本处理一个 SFML-C++ 项目?

问题描述

我正在开发一个需要SFML(免费可移植库)和一些可以复制到 USB 棒/驱动器上的依赖项的 C++ 项目。

问题是我在家里使用 Visual Studio 2019并且经常在 uni/work 使用 Visual Studio 2013

每当我尝试从另一个版本运行项目时,都会抛出异常和其他错误。唯一的解决办法是创建一个新项目并烦人地添加每个依赖项和 lib 文件夹,我绝对会 100% 积极避免不惜一切代价...

除了为每个 VS 版本制作两个单独的项目外,我如何使用不同版本的 Visual Studio 处理一个项目?

我尝试使用可移植的代码块 17.02 副本,但 IDE 使用起来不是很愉快,特别是因为我拥有 Visual Studio 密钥,其他学生也会在 Visual Studio 中查看代码。

这只是一些简单的窗口创建示例:

#include <SFML\Graphics.hpp>
using namespace sf;
int main()
{
    RenderWindow Window;
    Window.create(VideoMode(800, 800), "VS2013-VS2019Example");
    while (Window.isOpen()) {
        Event e;
        while (Window.pollEvent(e)) {
            if (e.type == Event::Closed) {
                Window.close();
            }
        }
        Window.clear();
        Window.display();
    }
}

I expected the program to create a new window, 800x800 with a title and no interception.
Starting the program will result in VS indicating that line 8, the line where window.create() is called, throws a Access violation reading location 0x000FFF exception at 0x0F15A5E3 (msvcp120.dll) in [project name].exe.

标签: c++visual-studiovisual-c++sfml

解决方案


推荐阅读