4

我只是想在我的新计算机上移动我的程序源并安装 Codeblocks 12.11 并按照 SFMLCoder 的最新说明自行编译 SFML 2。一切正常。当我尝试编译这个时:

#include <iostream>

using namespace std;

#include <SFML/Window.hpp>

int main()
{
    cout << "Hello world!" << endl;

    sf::Window w( sf::VideoMode( 800, 600 ), "test" );

    return 0;
}

我尝试了静态(在 Buildoptions 的 C::B 中定义 SFML_STATIC)、动态和两个调试库。但总是在它链接文件之后它说: main.cpp|11|undefined reference to sf::Window::Window(sf::VideoMode, std::string const&, unsigned int, sf::ContextSettings const&) 或者使用动态库时 main.cpp|11|undefined reference to _imp___ZN2sf6WindowC1ENS_9VideoModeERKSsjRKNS_15ContextSettingsE ,这显然等同于静态链接错误。

编辑:我在官方SFML 论坛中发现了一个问题完全相同的问题:如果我做对了,我会发布解决方案。

4

1 回答 1

0

I added myself into this discussion and it reveals that I had to download the version from github and I had to include SFML/Window.hpp. It works from now on. Hope this answer helps others too.

于 2013-03-06T18:53:27.443 回答