Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
library includes, Can't figure this simple compile problem [SFML2]
Post Body

I am able to compile an app with lib SFML2 in visual studio. I'm having trouble using the command line.

I'm trying:

C:\Users\jake\Documents\cpp\2013\sfml test\hi world>g   -Wall -I"C:\cpp_libs\sfm
l-2.0 - VS2012\VS11x32\include" -L"C:\cpp_libs\sfml-2.0 - VS2012\VS11x32\lib" -l
sfml-main -lsfml-graphics -lsfml-window -lsfml-system hiworld.cpp -o hiworld.exe

C:\Users\jake\AppData\Local\Temp\cc9k6cut.o:hiworld.cpp:(.text 0xd4): undefined
reference to `_imp___ZN2sf6StringC1EPKcRKSt6locale'
C:\Users\jake\AppData\Local\Temp\cc9k6cut.o:hiworld.cpp:(.text 0xfa): undefined
reference to `_imp___ZN2sf9VideoModeC1Ejjj'
C:\Users\jake\AppData\Local\Temp\cc9k6cut.o:hiworld.cpp:(.text 0x135): undefined
 reference to `_imp___ZN2sf6WindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextS
ettingsE'
C:\Users\jake\AppData\Local\Temp\cc9k6cut.o:hiworld.cpp:(.text 0x165): undefined
 reference to `_imp___ZN2sf6Window5closeEv'
C:\Users\jake\AppData\Local\Temp\cc9k6cut.o:hiworld.cpp:(.text 0x17b): undefined
 reference to `_imp___ZN2sf6Window9pollEventERNS_5EventE'
C:\Users\jake\AppData\Local\Temp\cc9k6cut.o:hiworld.cpp:(.text 0x18d): undefined
 reference to `_imp___ZNK2sf6Window6isOpenEv'
C:\Users\jake\AppData\Local\Temp\cc9k6cut.o:hiworld.cpp:(.text 0x1a4): undefined
 reference to `_imp___ZN2sf6WindowD1Ev'
C:\Users\jake\AppData\Local\Temp\cc9k6cut.o:hiworld.cpp:(.text 0x1d5): undefined
 reference to `_imp___ZN2sf6WindowD1Ev'
C:\Users\jake\AppData\Local\Temp\cc9k6cut.o:hiworld.cpp:(.text 0x1ff): undefined
 reference to `_imp___ZN2sf6WindowD1Ev'
collect2: ld returned 1 exit status

This mentions a macro, but how do you do that? ( And I didn't have to, in visual studio. )

you have to define the SFML_DYNAMIC macro in your project's settings. If you don't, you'll get linker errors when compiling your application.

edit: The code is simple:

#include <SFML/Window.hpp>

int main()
{
    sf::Window window(sf::VideoMode(800,600), "SFML hi world");

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

Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
No
Total Karma
69,023
Link Karma
3,135
Comment Karma
65,580
Profile updated: 6 days ago
Posts updated: 4 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
11 years ago