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

Author Topic: Hello world will not link, mingw  (Read 1040 times)

0 Members and 1 Guest are viewing this topic.

erus

  • Newbie
  • *
  • Posts: 2
    • View Profile
Hello world will not link, mingw
« on: February 06, 2012, 10:34:26 pm »
Building against the current git head, which compiled fine with cmake and mingw

Code: [Select]
#include <SFML/System.hpp>
#include <iostream>

int main()
{
    sf::Clock Clock;
    while (Clock.GetElapsedTime().AsSeconds() < 5.f)
    {
        std::cout << Clock.GetElapsedTime().AsSeconds() << std::endl;
        sf::Sleep(sf::Seconds(0.5f));
    }

    return 0;
}


and compiling with:
Code: [Select]
g++ -I/c/sfml/include -L/c/sfml/lib -lsfml-system test.cpp

I get the following error:
Code: [Select]
C:\Users\tommo\Desktop\ga>g++ -I/c/sfml/include -L/c/sfml/lib -lsfml-system test.cpp
C:\Users\tommo\AppData\Local\Temp\cck7pgPY.o:test.cpp:(.text+0x16): undefined reference to `_imp___ZN2sf5ClockC1Ev'
C:\Users\tommo\AppData\Local\Temp\cck7pgPY.o:test.cpp:(.text+0x26): undefined reference to `_imp___ZNK2sf5Clock14GetElapsedTimeEv'
C:\Users\tommo\AppData\Local\Temp\cck7pgPY.o:test.cpp:(.text+0x3c): undefined reference to `_imp___ZNK2sf4Time9AsSecondsEv'
C:\Users\tommo\AppData\Local\Temp\cck7pgPY.o:test.cpp:(.text+0x73): undefined reference to `_imp___ZN2sf7SecondsEf'
C:\Users\tommo\AppData\Local\Temp\cck7pgPY.o:test.cpp:(.text+0x81): undefined reference to `_imp___ZN2sf5SleepENS_4TimeE'
C:\Users\tommo\AppData\Local\Temp\cck7pgPY.o:test.cpp:(.text+0x8f): undefined reference to `_imp___ZNK2sf5Clock14GetElapsedTimeEv'
C:\Users\tommo\AppData\Local\Temp\cck7pgPY.o:test.cpp:(.text+0xa5): undefined reference to `_imp___ZNK2sf4Time9AsSecondsEv'
collect2: ld returned 1 exit status


Has anyone else had any luck compiling with mingw?

erus

  • Newbie
  • *
  • Posts: 2
    • View Profile
Hello world will not link, mingw
« Reply #1 on: February 07, 2012, 09:37:25 am »
I just needed to put the libraries after the source files :|

 

anything