0

私は答えを探していましたが、見つけたのは同様の問題ですが、答えはまったく役に立ちません。

最終的なプロジェクトに SFML を使用しようとしています (Minigore のようなゲームを作成したいと考えています)。画像を読み込んでスプライトに入れようとしています。

ここに私のコードがあります:

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

int main()
{
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");

while(App.IsOpened())
{
    sf::Clock Clock;
    while (Clock.GetElapsedTime() < 5.f)
    {
        std::cout << Clock.GetElapsedTime() << std::endl;
        sf::Sleep(0.5f);
    }

    sf::Image image;
    sf::Sprite sprite;

    if(!image.LoadFromFile("BaronsheetBas1.gif"))
    {

    }
    else
    {
        sprite.SetImage(image);
    }
}



    return 0;
}

コンパイルすると、これらのエラーが発生し続けます。

1>------ Début de la génération : Projet : SFML_Affiche_image, Configuration : Debug Win32 ------
1>La génération a démarré 2013-04-30 19:07:23.
1>InitializeBuildStatus:
1>  Mise à jour de l'horodatage "Debug\SFML_Affiche_image.unsuccessfulbuild".
1>ClCompile:
1>  Toutes les sorties sont à jour.
1>LINK : warning LNK4098: conflit entre la bibliothèque par défaut 'MSVCRT' et les autres bibliothèques ; utilisez /NODEFAULTLIB:library
1>sfml-window-s.lib(WindowImplWin32.obj) : warning LNK4049: symbole défini localement ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) importé
1>sfml-window-s.lib(Window.obj) : warning LNK4049: symbole défini localement ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) importé
1>sfml-window-s.lib(VideoMode.obj) : warning LNK4049: symbole défini localement ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) importé
1>sfml-window-s.lib(WindowImpl.obj) : warning LNK4049: symbole défini localement ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) importé
1>sfml-window-s.lib(VideoModeSupport.obj) : warning LNK4049: symbole défini localement ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) importé
1>sfml-graphics-s.lib(RenderWindow.obj) : warning LNK4217: symbole défini localement ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) importé dans la fonction "public: virtual __thiscall std::logic_error::~logic_error(void)" (??1logic_error@std@@UAE@XZ)
1>sfml-graphics-s.lib(Image.obj) : warning LNK4217: symbole défini localement ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) importé dans la fonction __ehhandler$??0logic_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z
1>sfml-graphics-s.lib(Sprite.obj) : warning LNK4049: symbole défini localement ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) importé
1>sfml-graphics-s.lib(ImageLoader.obj) : warning LNK4217: symbole défini localement ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)) importé dans la fonction "public: __thiscall std::logic_error::logic_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0logic_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z)
1>sfml-window-s.lib(WindowImplWin32.obj) : warning LNK4049: symbole défini localement ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)) importé
1>sfml-window-s.lib(Window.obj) : warning LNK4049: symbole défini localement ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)) importé
1>sfml-window-s.lib(VideoMode.obj) : warning LNK4049: symbole défini localement ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)) importé
1>sfml-window-s.lib(WindowImpl.obj) : warning LNK4049: symbole défini localement ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)) importé
1>sfml-window-s.lib(VideoModeSupport.obj) : warning LNK4049: symbole défini localement ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)) importé
1>sfml-graphics-s.lib(RenderWindow.obj) : warning LNK4217: symbole défini localement ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)) importé dans la fonction "protected: static void __cdecl std::vector<unsigned char,class std::allocator<unsigned char> >::_Xlen(void)" (?_Xlen@?$vector@EV?$allocator@E@std@@@std@@KAXXZ)
1>sfml-graphics-s.lib(Image.obj) : warning LNK4049: symbole défini localement ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)) importé
1>sfml-graphics-s.lib(Sprite.obj) : warning LNK4049: symbole défini localement ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)) importé
1>sfml-graphics-s.lib(ImageLoader.obj) : warning LNK4217: symbole défini localement ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z (public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)) importé dans la fonction "public: __thiscall std::logic_error::logic_error(class std::logic_error const &)" (??0logic_error@std@@QAE@ABV01@@Z)
1>sfml-graphics-s.lib(ImageLoader.obj) : warning LNK4217: symbole défini localement ?npos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@2IB (public: static unsigned int const std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::npos) importé dans la fonction "public: bool __thiscall sf::priv::ImageLoader::SaveImageToFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<class sf::Color,class std::allocator<class sf::Color> > const &,unsigned int,unsigned int)" (?SaveImageToFile@ImageLoader@priv@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$vector@VColor@sf@@V?$allocator@VColor@sf@@@std@@@5@II@Z)
1>sfml-window-s.lib(WindowImplWin32.obj) : error LNK2001: symbole externe non résolu "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z)
1>sfml-window-s.lib(Window.obj) : error LNK2001: symbole externe non résolu "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z)
1>sfml-window-s.lib(VideoMode.obj) : error LNK2001: symbole externe non résolu "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z)
1>sfml-window-s.lib(WindowImpl.obj) : error LNK2001: symbole externe non résolu "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z)
1>sfml-window-s.lib(VideoModeSupport.obj) : error LNK2001: symbole externe non résolu "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z)
1>sfml-graphics-s.lib(RenderWindow.obj) : error LNK2019: symbole externe non résolu "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) référencé dans la fonction "public: __thiscall std::logic_error::logic_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0logic_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z)
1>sfml-graphics-s.lib(Image.obj) : error LNK2001: symbole externe non résolu "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z)
1>sfml-graphics-s.lib(Sprite.obj) : error LNK2001: symbole externe non résolu "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z)
1>sfml-graphics-s.lib(ImageLoader.obj) : error LNK2001: symbole externe non résolu "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z)
1>sfml-graphics-s.lib(Image.obj) : error LNK2019: symbole externe non résolu "__declspec(dllimport) public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,int)" (__imp_?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z) référencé dans la fonction "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z)
1>sfml-graphics-s.lib(ImageLoader.obj) : error LNK2001: symbole externe non résolu "__declspec(dllimport) public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,int)" (__imp_?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z)
1>sfml-window-s.lib(Window.obj) : error LNK2001: symbole externe non résolu "__declspec(dllimport) public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,int)" (__imp_?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z)
1>sfml-window-s.lib(WindowImplWin32.obj) : error LNK2001: symbole externe non résolu "__declspec(dllimport) public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,int)" (__imp_?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z)
1>sfml-graphics-s.lib(ImageLoader.obj) : error LNK2019: symbole externe non résolu "__declspec(dllimport) class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z) référencé dans la fonction "public: bool __thiscall sf::priv::ImageLoader::LoadImageFromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<class sf::Color,class std::allocator<class sf::Color> > &,unsigned int &,unsigned int &)" (?LoadImageFromFile@ImageLoader@priv@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$vector@VColor@sf@@V?$allocator@VColor@sf@@@std@@@5@AAI2@Z)
1>sfml-graphics-s.lib(ImageLoader.obj) : error LNK2019: symbole externe non résolu "__declspec(dllimport) bool __cdecl std::operator==<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *)" (__imp_??$?8DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z) référencé dans la fonction "public: bool __thiscall sf::priv::ImageLoader::SaveImageToFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<class sf::Color,class std::allocator<class sf::Color> > const &,unsigned int,unsigned int)" (?SaveImageToFile@ImageLoader@priv@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$vector@VColor@sf@@V?$allocator@VColor@sf@@@std@@@5@II@Z)
1>sfml-graphics-s.lib(ImageLoader.obj) : error LNK2019: symbole externe non résolu "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::substr(unsigned int,unsigned int)const " (__imp_?substr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV12@II@Z) référencé dans la fonction "public: bool __thiscall sf::priv::ImageLoader::SaveImageToFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<class sf::Color,class std::allocator<class sf::Color> > const &,unsigned int,unsigned int)" (?SaveImageToFile@ImageLoader@priv@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$vector@VColor@sf@@V?$allocator@VColor@sf@@@std@@@5@II@Z)

時計は完全に機能します (私は単独で試しました) が、画像を読み込んでスプライトに入れようとすると、これらのエラーが表示されました。

これらのライブラリをプロジェクトに含めようとしましたが、まだエラーがあります - sfml-main.lib - sfml-system-s.lib と sfml-system-sd.lib - sfml-graphics-s.lib と sfml-graphics -sd.lib - sfml-window-s.lib および sfml-window-sd.lib

私は今何をすべきか本当に知りません:/

誰かが答えを持っているか、私がそれを見つけるのを手伝ってくれるなら、それを共有するのはとてもいいでしょう:)

ありがとう !!!

注: 私の英語で申し訳ありませんが、それは私の最初の言語ではありません。

4

3 に答える 3

1

みんな、見つけた。

ライブラリをLinker Inputに入れなければなりませんでした

sfml-graphics.lib, sfml-window.lib, sfml-system.lib

-sを入れずに....

皆さんへの最後の質問です。Visual Studio がファイルを見つけられないと言っていたので、プロジェクトに 3 つの .dll をすべて入れなければならないのは普通ですか?

どうもありがとうございました !

于 2013-05-01T12:38:11.363 に答える