SFML problem

DirectX & XNA, OpenGL...
Post Reply
User avatar
OmegaApex
Posts: 551
Joined: Sat Aug 08, 2009 1:34 pm
Smallest prime number bigger than 20: 23

SFML problem

Post by OmegaApex » Sat Dec 24, 2011 9:58 am

Evo postavio sam SFML u CodeBlocks-u i onda sam kopirao kod sa stranice i kada taj kod pokrenem pokaže mi se samo taj cmd prozor i tako svaki put kada pokušam otvoriti neki prozor pomoću SFML-a.Zna li netko u čemu je problem?

http://imageshack.us/photo/my-images/715/21742770.png/" onclick="window.open(this.href);return false;

Code: Select all

#include <SFML/Graphics.hpp>


int main()
{
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();

            // A key has been pressed
            if (Event.Type == sf::Event::KeyPressed)
            {
                // Escape key : exit
                if (Event.Key.Code == sf::Key::Escape)
                    App.Close();

                // F1 key : capture a screenshot
                if (Event.Key.Code == sf::Key::F1)
                {
                    sf::Image Screen = App.Capture();
                    Screen.SaveToFile("screenshot.jpg");
                }
            }
        }

        // Clear the screen with red color
        App.Clear(sf::Color(200, 0, 0));

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}


A neutron walks into a bar and asks how much for a drink. The bartender replies "for you, no charge".

User avatar
Denis
Sajentist on djuti!
Posts: 2618
Joined: Tue Aug 26, 2008 9:35 pm
Smallest prime number bigger than 20: 23

Re: SFML problem

Post by Denis » Sat Dec 24, 2011 11:46 am

Pokušaj ovaj kod:

Code: Select all

#include <SFML/Window.hpp>

int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

    // Start main loop
    bool Running = true;
    while (Running)
    {
        App.Display();
    }

    return EXIT_SUCCESS;
}
Koristiš SFML 1.6?

User avatar
OmegaApex
Posts: 551
Joined: Sat Aug 08, 2009 1:34 pm
Smallest prime number bigger than 20: 23

Re: SFML problem

Post by OmegaApex » Sat Dec 24, 2011 1:50 pm

Isto ko i u ovom mojem slučaju! angry** ...Da koristim 1.6
A neutron walks into a bar and asks how much for a drink. The bartender replies "for you, no charge".

User avatar
Mihael
Thunder Snail
Posts: 1386
Joined: Thu Aug 13, 2009 3:06 pm
Smallest prime number bigger than 20: 23

Re: SFML problem

Post by Mihael » Sun Dec 25, 2011 12:12 pm

Ja nikad nisam uspio pokrenuti SFML u CodeBlocksu, probaj sa VS 2008, po meni je jednostavnije za iskonfigurirati te je jednostavnije compileati ako se hoces igrat sa SFMl 2.0

User avatar
OmegaApex
Posts: 551
Joined: Sat Aug 08, 2009 1:34 pm
Smallest prime number bigger than 20: 23

Re: SFML problem

Post by OmegaApex » Sun Dec 25, 2011 1:00 pm

Konfigurirao sam u VC++ 2010,također mi je samo prikazan taj CMD bez prozora...Probao sam i SFML 2 sa onim cmake-om ali mi javlja puno errora kad upisem ovo:

Code: Select all

cmake -G "NMake Makefiles" -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=TRUE -D STATIC_STD_LIBS=FALSE c:/sfml/sfml2/
A neutron walks into a bar and asks how much for a drink. The bartender replies "for you, no charge".

User avatar
Mihael
Thunder Snail
Posts: 1386
Joined: Thu Aug 13, 2009 3:06 pm
Smallest prime number bigger than 20: 23

Re: SFML problem

Post by Mihael » Sun Dec 25, 2011 3:04 pm

Za svaki program moras iskonfigurirati compiler/linker (lokacije vjerojatno ne), mozda si zaboravio postaviti linker opcije (ili ih nisi poredao kako treba?)

Code: Select all

-lsfml-graphics
-lsfml-window
-lsfml-system
To je vjerojatno to za taj pocetni program.

User avatar
OmegaApex
Posts: 551
Joined: Sat Aug 08, 2009 1:34 pm
Smallest prime number bigger than 20: 23

Re: SFML problem

Post by OmegaApex » Sun Dec 25, 2011 3:57 pm

ma sve sam probal al' nikako da uspije...Sad sam postavio ovako kako si ti rekao i sad dobijem ovo:

Code: Select all

1>------ Build started: Project: test2, Configuration: Debug Win32 ------
1>LINK : warning LNK4044: unrecognized option '/lsfml-graphics'; ignored
1>LINK : warning LNK4044: unrecognized option '/lsfml-window'; ignored
1>LINK : warning LNK4044: unrecognized option '/lsfml-system'; ignored
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Window::~Window(void)" (__imp_??1Window@sf@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Display(void)" (__imp_?Display@Window@sf@@QAEXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Window::Window(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (__imp_??0Window@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@1@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function _main
1>c:\users\vedran\documents\visual studio 2010\Projects\test2\Debug\test2.exe : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
A neutron walks into a bar and asks how much for a drink. The bartender replies "for you, no charge".

User avatar
OmegaApex
Posts: 551
Joined: Sat Aug 08, 2009 1:34 pm
Smallest prime number bigger than 20: 23

Re: SFML problem

Post by OmegaApex » Sun Dec 25, 2011 4:23 pm

A dobro otkrio sam problem izgleda da sfml 1.6 ne radi na windowsima sa ati grafičkom?...Sada samo trebam nekako sfml 2 upogoniti
A neutron walks into a bar and asks how much for a drink. The bartender replies "for you, no charge".

User avatar
Mihael
Thunder Snail
Posts: 1386
Joined: Thu Aug 13, 2009 3:06 pm
Smallest prime number bigger than 20: 23

Re: SFML problem

Post by Mihael » Sun Dec 25, 2011 4:24 pm

Hm... imam osjecaj da nisi dobro lokacije postavio ili za linker ili za compiler...

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest