Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - rush905

Pages: [1]
1
General / [SFML 2.0] Error Linking
« on: February 11, 2013, 07:40:31 pm »
I'm currently running GNU/Linux Mint and trying to get SFML 2.0 running. I went into the tutorial for Linux for SFML 2.0 and used the sample code. I downloaded and placed the include/SFML into /usr/include. And I also placed SFML/lib into /usr/lib.

I was then able to compile the source from the tutorial successfully with "g++ -c main.cpp"
But when I tried to link it with "g++ main.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system"

I got these errors. Any ideas?:

/usr/bin/ld: warning: libGLEW.so.1.5, needed by /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewUniform1fARB'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_shader_objects'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewGetObjectParameterivARB'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_vertex_shader'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewFramebufferTexture2DEXT'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewUniformMatrix4fvARB'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewGenFramebuffersEXT'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewUniform3fARB'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewRenderbufferStorageEXT'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_fragment_shader'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewActiveTextureARB'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewShaderSourceARB'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `glewInit'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewBindFramebufferEXT'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewFramebufferRenderbufferEXT'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewLinkProgramARB'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewUseProgramObjectARB'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewBlendFuncSeparateEXT'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewGenRenderbuffersEXT'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewUniform2fARB'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewUniform4fARB'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewCreateProgramObjectARB'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `glewGetErrorString'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewCompileShaderARB'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewDeleteObjectARB'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewGetUniformLocationARB'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewGetInfoLogARB'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__GLEW_EXT_blend_func_separate'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewDeleteFramebuffersEXT'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewCheckFramebufferStatusEXT'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewUniform1iARB'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_texture_non_power_of_two'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_shading_language_100'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewCreateShaderObjectARB'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewBindRenderbufferEXT'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__GLEW_EXT_framebuffer_object'

/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewAttachObjectARB'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libsfml-graphics.so: undefined reference to `__glewGetHandleARB'

collect2: error: ld returned 1 exit status

2
General / Linker Errors
« on: September 11, 2012, 12:42:54 am »
Hi, I'm setting up SFML again for my project, but I keep getting these linking errors:

Error   10      error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::setFramerateLimit(unsigned int)" (__imp_?setFramerateLimit@Window@sf@@QAEXI@Z) referenced in function "void __cdecl invent(void)" (?invent@@YAXXZ) C:\Users\Anonymous\Documents\Visual Studio 2010\Projects\Game\Game\main.obj
Error   12      error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::display(void)" (__imp_?display@Window@sf@@QAEXXZ) referenced in function _main     C:\Users\Anonymous\Documents\Visual Studio 2010\Projects\Game\Game\main.obj
Error   8       error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::close(void)" (__imp_?close@Window@sf@@QAEXXZ) referenced in function "void __cdecl invent(void)" (?invent@@YAXXZ)  C:\Users\Anonymous\Documents\Visual Studio 2010\Projects\Game\Game\main.obj
Error   7       error LNK2019: unresolved external symbol "__declspec(dllimport) public: static bool __cdecl sf::Keyboard::isKeyPressed(enum sf::Keyboard::Key)" (__imp_?isKeyPressed@Keyboard@sf@@SA_NW4Key@12@@Z) referenced in function "void __cdecl invent(void)" (?invent@@YAXXZ) C:\Users\Anonymous\Documents\Visual Studio 2010\Projects\Game\Game\main.obj
Error   9       error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::pollEvent(class sf::Event &)" (__imp_?pollEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function "void __cdecl invent(void)" (?invent@@YAXXZ) C:\Users\Anonymous\Documents\Visual Studio 2010\Projects\Game\Game\main.obj
Error   13      error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::isOpen(void)const " (__imp_?isOpen@Window@sf@@QBE_NXZ) referenced in function _main        C:\Users\Anonymous\Documents\Visual Studio 2010\Projects\Game\Game\main.obj
Error   11      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 "void __cdecl invent(void)" (?invent@@YAXXZ)    C:\Users\Anonymous\Documents\Visual Studio 2010\Projects\Game\Game\main.obj
Error   14      error LNK1120: 7 unresolved externals   C:\Users\Anonymous\Documents\Visual Studio 2010\Projects\Game\Debug\Game.exe    1
 


I followed the tutorial for Visual C++, and I still can't figure it out. Any ideas?

Source:

#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <Windows.h>
#include "Collision.hpp"
#include "Inventory.hpp"

const int sleepTime = 200;

       
int main()
{
        //Create window, and limit frame rate
        sf::RenderWindow window (sf::VideoMode(800, 600, 32), "Game", sf::Style::Default);
        window.setFramerateLimit(60);

//------------------------TEXTURES------------------------------

        //Declare textures
        sf::Texture texture;
        sf::Texture texture1;
        sf::Texture texture2;
        //Load image
        if(!texture.loadFromFile("Sprites/main.png"))
        {
                return 1;
        }
        if(!texture1.loadFromFile("Sprites/background.png"))
        {
                return 1;
        }
        if(!texture2.loadFromFile("Sprites/house.png"))
        {
                return 1;
        }

//------------------------SPRITES--------------------------

        //Creates and places the sprites
        sf::Sprite sprite;
        sf::Sprite background;
        sf::Sprite house;
        sprite.setPosition(400, 300);
        background.setPosition(0, 0);
        house.setPosition(440, 300);

        //Loads texture into sprite
        sprite.setTexture(texture);
        background.setTexture(texture1);
        house.setTexture(texture2);

//-------------------------RECTANGLES--------------------------------

        //Declares the rectangles
        sf::IntRect front(1, 1, 18, 24);
        sf::IntRect back (20, 1, 18, 24);
        sf::IntRect left (20, 26, 18, 24);
        sf::IntRect right (1, 26, 18, 24);
        //Steps
        sf::IntRect frontLeft(39, 1, 18, 24);
        sf::IntRect frontRight(39, 26, 18, 24);
        sf::IntRect backLeft();
        sf::IntRect backRight();
        sf::IntRect leftLeft();
        sf::IntRect leftRight();
        sf::IntRect rightLeft();
        sf::IntRect rightRight();

        sf::IntRect backgroundRect (0, 0, 800, 600);

        sf::IntRect houseRect (0, 0, 17, 22);

       
        //Crop sprites using rectangles defined above
        sprite.setTextureRect(front);
        background.setTextureRect(backgroundRect);
        house.setTextureRect(houseRect);

//-----------------------SOUND------------------------------------------------------

        //Declare the Sound Buffer
        sf::SoundBuffer footstepsBuffer;
        sf::SoundBuffer bumpBuffer;
        //Loads the sound file
        if(!footstepsBuffer.loadFromFile("Sounds/footsteps.wav"))
        {
                return 1;
        }
        if(!bumpBuffer.loadFromFile("Sounds/bump.wav"))
        {
                return 1;
        }

        //Declare sound
        sf::Sound footsteps;
        sf::Sound bump;
        //Load Buffer into Sound
        footsteps.setBuffer(footstepsBuffer);
        bump.setBuffer(bumpBuffer);

//-------------------------------MAIN-----------------------------

        //Main window loop
        while(window.isOpen())
        {
                sf::Event event;

                //Vectors used for collision
                sf::Vector2i spritePosition(sprite.getPosition());
                sf::Vector2i backgroundPosition(background.getPosition());
                sf::Vector2i housePosition(house.getPosition());

                //Sprite Vectors
                sf::Vector2i backVector(back.width, back.height);
                sf::Vector2i frontVector(front.width, front.height);
                sf::Vector2i rightVector(right.width, right.height);
                sf::Vector2i leftVector(left.width, left.height);

                //House Vectors
                sf::Vector2i houseVector(houseRect.width, houseRect.height);

                while(window.pollEvent(event))
                {
                        if(event.type == sf::Event::Closed)
                        {
                                window.close();
                        }

                        if(event.key.code == sf::Keyboard::Insert)
                        {
                                sf::Image screenshot = window.capture();
                                screenshot.saveToFile("Screenshot.png");
                        }
                }

//------------------------------Inventory------------------------------------
                if(sf::Keyboard::isKeyPressed(sf::Keyboard::I))
                {
                        sf::Thread window2(&invent);
                        inventoryIsOpen = !inventoryIsOpen;
                        if(inventoryIsOpen){
                                invent();
                                window2.wait();
                        }
                        else{

                        }
                }

//-----------------------------------MOVEMENT----------------------------------------

                if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
                {
                        //Change to stepping sprite
                        Sleep(sleepTime);
                        sprite.setTextureRect(back);
                        sprite.move(0, -24);
                        //Redeclaring the collision textures
                        sf::Vector2i spritePosition(sprite.getPosition());
                        sf::Vector2i housePosition(house.getPosition());
                        if(collision(spritePosition, backVector, housePosition, houseVector) == true)
                        {
                                sprite.move(0, 24);
                                bump.play();
                        }
                        else
                        {
                                footsteps.play();
                        }
                }

                else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
                {
                        //Change to stepping sprite
                        Sleep(sleepTime);
                        sprite.setTextureRect(front);
                        sprite.move(0, 24);
                        //Redeclaring the collision textures
                        sf::Vector2i spritePosition(sprite.getPosition());
                        sf::Vector2i housePosition(house.getPosition());
                        if(collision(spritePosition, frontVector, housePosition, houseVector) == true)
                        {
                                sprite.move(0, -24);
                                bump.play();
                        }
                        else
                        {
                                footsteps.play();
                        }
                }

                else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
                {
                        //Change to stepping sprite
                        Sleep(sleepTime);
                        sprite.setTextureRect(right);
                        sprite.move(19, 0);
                        //Redeclaring the collision textures
                        sf::Vector2i spritePosition(sprite.getPosition());
                        sf::Vector2i housePosition(house.getPosition());
                        if(collision(spritePosition, leftVector, housePosition, houseVector) == true)
                        {
                                sprite.move(-19, 0);
                                bump.play();
                        }
                        else
                        {
                                footsteps.play();
                        }
                }

                else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
                {
                        //Change to stepping sprite
                        Sleep(sleepTime);
                        sprite.setTextureRect(left);
                        sprite.move(-19, 0);
                        //Redeclaring the collision textures
                        sf::Vector2i spritePosition(sprite.getPosition());
                        sf::Vector2i housePosition(house.getPosition());
                        if(collision(spritePosition, rightVector, housePosition, houseVector) == true)
                        {
                                sprite.move(19, 0);
                                bump.play();
                        }
                        else
                        {
                                footsteps.play();
                        }
                }

                //Draw sequence
                window.clear(); //(Red, Green, Blue, (optional) Alpha) Alpha is transperency

                //Draw....

                window.draw(background);

                window.draw(house);

                window.draw(sprite);

                window.display();
        }
        return 0;
}

3
General / sf::Seconds delay?
« on: August 23, 2012, 07:01:17 am »
I'm trying to get a delay in between events. The point of this is so that when the user tries to move the character, they can't simply hold down the arrow key and fly off into the distance. Now I looked into the documentation for handling time, but all I could find was how to measure it. Now how to delay the program.

So is there any way to do this? I'm sure it's really simple, and I'm just not seeing the obvious here.

I don't think showing source here is necessary, but if anyone needs it, let me know.

4
Graphics / [2.0] Project keeps crashing
« on: August 21, 2012, 08:42:04 pm »
http://pastebin.com/9WZeMnHc

So whenever I compile and run my program, the window shows up, then closes right after. Is there something wrong with my source above?

5
General / Physics/Colission
« on: August 21, 2012, 06:16:50 pm »
Hi everyone, I'm hoping to write a 2D game in the near future, using SFML. I almost have rendering down, but now the problem I'm facing is learning how to get collision working. I can't find anything under the SFML 2.0 tutorials and was wondering if SFML even supports it. If anyone could point me in the right direction, I would be very grateful.

6
Graphics / Error trying to display sprite?
« on: August 21, 2012, 06:11:29 pm »
I'm writing a simple program to open a window, and render a sprite inside that window.

Here is my source:
http://pastebin.com/ndnRyjuf

And this is the error I'm getting:
Error   1   error LNK2001: unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)

Thank you in advance!

7
General / Setting up OpenGL with Visual C++?
« on: August 21, 2012, 01:45:28 am »
Hi, I'm trying to set up OpenGL with Visual C++ on Windows 7. I'm trying to get this source from the tutorial to compile:

http://pastebin.com/dFrUj4zk

But I get this error:
Error   1   error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function _main   C:\Users\Nick\Desktop\Rendering\Rendering\Rendering.obj



I would imagine that I need to add some sort of OpenGL.lib file, but when I try and add "sfml/opengl-d.lib" to the "additional dependencies" category under Linker settings, I get an error that it doesn't exist.


I couldn't find anything about this under the tutorial, or anywhere online. So if anyone could please have the patience to help me out with this simple problem I would be extremely grateful.

8
Window / Window Not Displaying?
« on: August 18, 2012, 12:35:12 am »
Hi everyone. I'm going through the tutorials on the SFML site, and I came across the Windows tutorial. http://www.sfml-dev.org/tutorials/1.6/graphics-window.php Anyways, I'm using Visual C++, have all the Linker options correct, and the .dlls in place, it even compiles. But in the end when I try to run the program, nothing happens. The process is running in the background, yet nothing's there.

Any help would be great. Thanks.

Source straight from the site:

>http://pastebin.com/kaa1t9UV

And if it helps, my Source:
> http://pastebin.com/aiy2ra6w

Pages: [1]
anything