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.


Messages - xLuka

Pages: [1]
1
General / Re: Can't load image (C++, CodeBlocks)
« on: April 22, 2019, 12:30:53 pm »
If you have activated C++11 support, then you'll probably have to rebuild SFML with the same compiler flags, otherwise the runtimes are in conflict.

No, I have C++14

2
General / Re: Can't load image (C++, CodeBlocks)
« on: April 22, 2019, 12:27:27 pm »
Do you need to include texture.hpp?
#include <Texture.hpp>

Regards,

Jeff Cummings

I tried, but it says : fatal error : <Texture.hpp> no such file or directory ;(

3
General / Re: Can't load image (C++, CodeBlocks)
« on: April 22, 2019, 12:26:28 pm »
Although I can't explain your error, I would like to just point out something important in your code: your clear/draw/display (and return) should not be within the event type switch or even the event loop. To fix, place 2 closing braces before window.clear() and remove 2 closing braces from the end of the code.

Thank you for that :D

4
General / Can't load image (C++, CodeBlocks)
« on: April 22, 2019, 12:20:58 am »
Hey, can anyone help me about this?

My code:
#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
 sf::RenderWindow window(sf::VideoMode(1280, 720), "SFML Test Program", sf::Style::Close | sf::Style::Resize);
 sf::RectangleShape player(sf::Vector2f(100.0f,100.0f));
player.setPosition(206.0f, 206.0f);
sf::Texture playerTexture;
playerTexture.loadFromFile("dino.jpg");
player.setTexture(&playerTexture);





 while(window.isOpen()) {
     sf::Event evnt;
     while(window.pollEvent(evnt)){

        switch (evnt.type)
        {
           case sf::Event::Closed:
            window.close();
           break;

     window.clear();
     window.draw(player);
     window.display();
 }
    return 0;
}}}


The error I get every time:
||=== Build: Debug in sfmlprogram (compiler: GNU GCC Compiler) ===|
obj\Debug\main.o||In function `main':|
C:\Users\DJuca\Desktop\Programiranje Cpp\sfmlprogram\main.cpp|10|undefined reference to `_imp___ZN2sf7Texture12loadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_4RectIiEE'|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|

- So if anyone know what is it all about please answer me :P thank you

Pages: [1]
anything