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 - biitse

Pages: [1]
1
General / Re: Linking error with codeblocks (windows)
« on: January 21, 2020, 06:27:51 pm »
Given that the object file is located in the Debug directory, I assume it was built in debug mode (-g), as such you also need to link the debug SFML libraries, with the suffix -d

Okay, I just switched from debug to release and it compiled and ran perfectly. thank you :)

2
General / Linking error with codeblocks (windows)
« on: January 21, 2020, 12:21:18 am »
Im fairly new to programming so forgive me if I missed something obvious.

Im trying to compile this program from the tutorial
Quote
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

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

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}


This is the error I get when codeblocks compiles:
Quote
-------------- Build: Debug in hello (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe  -o bin\Debug\hello.exe obj\Debug\main.o  -lsfml-graphics -lsfml-window -lsfml-system 
obj\Debug\main.o: In function `main':
C:/Users/~/~/~/~/~/~/hello/main.cpp:9: undefined reference to `sf::Window::isOpen() const'
C:/Users/~/~/~/~/~/~/hello/main.cpp:12: undefined reference to `sf::Window::pollEvent(sf::Event&)'
collect2.exe: error: ld returned 1 exit status

What's strange to me is that it only gives me errors about sf::Window functions, which Im guessing is in lsfml-window.

Also, if I compile in command prompt with this:
Quote
g++ main.cpp -o hello -lsfml-graphics -lsfml-window -lsfml-system
Then I get no linking errors and I get a working .exe


Pages: [1]
anything