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

Pages: [1]
1
General / undefined reference
« on: January 14, 2018, 06:21:03 am »
I can compile the code as follows:
Quote
#include <SFML/Graphics.hpp>

int main()
{
}
But I can't compile this:
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;
}
Quote
C:\Users\Dolmatt\Desktop>g++ main.cpp -o main.exe -IC:\Utils\SFML-2.4.2\include
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0x83): undefined
reference to `__imp__ZN2sf6StringC1EPKcRKSt6locale'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0xa7): undefined
reference to `__imp__ZN2sf9VideoModeC1Ejjj'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0xeb): undefined
reference to `__imp__ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15Co
ntextSettingsE'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0x127): undefined
 reference to `__imp__ZN2sf11CircleShapeC1Efy'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0x130): undefined
 reference to `__imp__ZN2sf5Color5GreenE'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0x13e): undefined
 reference to `__imp__ZN2sf5Shape12setFillColorERKNS_5ColorE'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0x151): undefined
 reference to `__imp__ZNK2sf6Window6isOpenEv'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0x170): undefined
 reference to `__imp__ZN2sf6Window9pollEventERNS_5EventE'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0x18e): undefined
 reference to `__imp__ZN2sf6Window5closeEv'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0x1bc): undefined
 reference to `__imp__ZN2sf5ColorC1Ehhhh'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0x1da): undefined
 reference to `__imp__ZN2sf12RenderTarget5clearERKNS_5ColorE'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0x1e3): undefined
 reference to `__imp__ZN2sf12RenderStates7DefaultE'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0x1ff): undefined
 reference to `__imp__ZN2sf12RenderTarget4drawERKNS_8DrawableERKNS_12RenderState
sE'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0x212): undefined
 reference to `__imp__ZN2sf6Window7displayEv'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0x23b): undefined
 reference to `__imp__ZN2sf12RenderWindowD1Ev'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0x269): undefined
 reference to `__imp__ZN2sf12RenderWindowD1Ev'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text+0x2af): undefined
 reference to `__imp__ZN2sf12RenderWindowD1Ev'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text$_ZN2sf11CircleSha
peD1Ev[_ZN2sf11CircleShapeD1Ev]+0xf): undefined reference to `__imp__ZTVN2sf11Ci
rcleShapeE'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text$_ZN2sf11CircleSha
peD1Ev[_ZN2sf11CircleShapeD1Ev]+0x21): undefined reference to `__imp__ZTVN2sf11C
ircleShapeE'
C:\Users\Dolmatt\AppData\Local\Temp\ccGgdEUQ.o:main.cpp:(.text$_ZN2sf11CircleSha
peD1Ev[_ZN2sf11CircleShapeD1Ev]+0x3b): undefined reference to `__imp__ZN2sf5Shap
eD2Ev'
collect2.exe: error: ld returned 1 exit status
How to solve the problem?

2
General / I can't compile
« on: January 02, 2018, 12:04:20 am »
The program is as follows:
#include <SFML/Graphics.hpp>

int main()
{
 
}
Everything goes OK if I use
Quote
clang++ helloworld.cpp -I/usr/include/ -lsfml-graphics -lsfml-window -lsfml-system
. But when I try to cross-compile it for Windows I get an error:
Quote
clang++ helloworld.cpp -I/usr/include/ -lsfml-graphics -lsfml-window -lsfml-system -target x86_64-win32
helloworld.cpp:1:10: fatal error: 'ostream' file not found
#include <ostream>
         ^
1 error generated.
Any ideas how to fix?

Pages: [1]