English 中文(简体)
SFML 辅导 1. 表面问题
原标题:SFML tutorial 1: thread problems

Hi so i am using msVS++2010 and have been attempting to set up SFML all day.... I downloaded 1.6 from the site, then rebuilt it in VS2010, but sad to find that this did not result in a sfml-system-d.lib file, which is what i am used to using, and only produced new system-s and system-s-d libs.

接着,我密切注视了Video,发现他通过在外添加fml-system-s-d的校准,在外面添加显示工作的录像带的fml-system-dll,并读到以下正典:

#include <iostream>
#include <SFML/System.hpp>

int main(int argc, char **argv)
{
    sf::Clock clock;

    sf::Sleep(0.1f);

    while(clock.GetElapsedTime() < 5.0f)
    {
        std::cout << clock.GetElapsedTime() << std::endl;
        sf::Sleep(0.5f);
    }
}

显然24小时和睡眠都在发挥作用,但是,如果加上一条简单的编码线,则:Thread thread();一个错误的盒子pop起来,说,“无法启动方案”,“组合是不正确的,”“审查可能的错误的原始文件,”“储存我的固定装置

Also: when trying to run the first program of the tutorials regarding threads:

#include <SFML/System.hpp>
#include <iostream>

void ThreadFunction(void* UserData)
{
    // Print something...
    for (int i = 0; i < 10; ++i)
        std::cout << "I m the thread number 1" << std::endl;
}

int main()
{
    // Create a thread with our function
    sf::Thread Thread(&ThreadFunction);

    // Start it !
    Thread.Launch();

    // Print something...
    for (int i = 0; i < 10; ++i)
        std::cout << "I m the main thread" << std::endl;

    return EXIT_SUCCESS;
}

我获得8个无遗的外部象征,如:

1>sfml-system-s-d.lib(Thread.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall std::ios_base::width(int)" (__imp_?width@ios_base@std@@QAEHH@Z)
 fatal error LNK1120: 8 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Lastly this is how my project is set up:

  • include directory to out of the box, freshly downloaded SFML 1.6/include
  • lib directory to the VS2010 rebuilt SFML (debug/release DLL setting, and static).
  • extra dependency on sfml-system-s-d.lib file.
  • out of frusteration i placed every dll file next to the .exe
最佳回答

在建造SFML

除此以外,你需要重建SFML:

<>0> 复制本

kernel32.lib
user32.lib
gdi32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib

  1. go into each individual Project s Properties -> Configuration -> Linker -> Input. or if it doesn t have Linker go into Properties -> Configuration -> Librarian.

  2. Set "Ignore Default Libraries" to "no" and it will probably work

  3. 如果您的大麻是100%的安全,就点击额外依赖物,将其扩大,并点击“现在就在上文各行的过去”。

  4. If your in the librarian tab, set Link Library Dependencies to YES

  5. repeat steps 1-4 each time you change the build setting of Debug DLL, Debug static, etc.

当我与SFML公司(特许使用)合并时,我有静态的汇编,因为1.6是1x线的最后一行,2.0吨线相容。 我必须补充这些提法。 它将忽视(并警告忽视)它所需要的任何东西,但它们是违约行为。

不幸的是,你需要更新SFML解决方案中的所有内容,因为如果我正确回顾,他们都是丢失的图书馆。

问题回答

暂无回答




相关问题
Silverlight, Updating the UI during processing

I have a simple silverlight multifile upload application, and i want to provide the user with some feedback, right now its only in a test phase and i dont have the webservice. Somehow i cant get the ...

Is reading from an XmlDocument object thread safe?

I was wondering if i could safely read from an XmlDocument object using SelectNodes() and SelectSingleNode() from multiple threads with no problems. MSDN says that they are not guaranteed to be ...

Terminating a thread gracefully not using TerminateThread()

My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...

热门标签