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

Author Topic: Can't compile project  (Read 510 times)

0 Members and 1 Guest are viewing this topic.

het_best

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Can't compile project
« on: July 16, 2023, 03:24:07 pm »
SFML 2.6.0 and  g++

I am trying to compile my project with these commands:
g++ -c main.cpp -I"E:\C++\Real Engine\Real Engine\include" -DSFML_STATIC

g++ -L"E:\C++\Real Engine\Real Engine\lib\SFML" main.o -o main -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lopengl32 -lwinmm -lgdi32

But it gives the following error:
main.o:main.cpp:(.text+0x1c): undefined reference to `_imp____glutInitWithExit@12'      
main.o:main.cpp:(.text+0x3f): undefined reference to `_imp____glutCreateWindowWithExit@8'
main.o:main.cpp:(.text+0x61): undefined reference to `_imp____glutCreateMenuWithExit@8'  
main.o:main.cpp:(.text+0x7e): undefined reference to `sf::Shape::Shape()'
main.o:main.cpp:(.text+0xbe): undefined reference to `sf::Shape::update()'
main.o:main.cpp:(.text+0xcc): undefined reference to `sf::Shape::~Shape()'
main.o:main.cpp:(.text+0x106): undefined reference to `sf::Shape::update()'
main.o:main.cpp:(.text+0x145): undefined reference to `sf::Shape::update()'
main.o:main.cpp:(.text+0x2c2): undefined reference to `sf::Shape::Shape()'
main.o:main.cpp:(.text+0x305): undefined reference to `sf::Shape::update()'
main.o:main.cpp:(.text+0x313): undefined reference to `sf::Shape::~Shape()'
main.o:main.cpp:(.text+0x345): undefined reference to `sf::Shape::update()'
main.o:main.cpp:(.text+0x37d): undefined reference to `sf::Shape::update()'
main.o:main.cpp:(.text+0x3b5): undefined reference to `sf::Shape::update()'
main.o:main.cpp:(.text+0x5f3): undefined reference to `sf::Keyboard::isKeyPressed(sf::Keyboard::Key)'
main.o:main.cpp:(.text+0x616): undefined reference to `sf::Joystick::isConnected(unsigned int)'
main.o:main.cpp:(.text+0x639): undefined reference to `sf::Joystick::isConnected(unsigned int)'
main.o:main.cpp:(.text+0x648): undefined reference to `sf::Joystick::getButtonCount(unsigned int)'
main.o:main.cpp:(.text+0x662): undefined reference to `sf::Joystick::isConnected(unsigned int)'
main.o:main.cpp:(.text+0x678): undefined reference to `sf::Joystick::isButtonPressed(unsigned int, unsigned int)'
main.o:main.cpp:(.text+0x692): undefined reference to `sf::Joystick::isConnected(unsigned int)'
main.o:main.cpp:(.text+0x6a8): undefined reference to `sf::Joystick::getAxisPosition(unsigned int, sf::Joystick::Axis)'
main.o:main.cpp:(.text+0x720): undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
main.o:main.cpp:(.text+0x808): undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
main.o:main.cpp:(.text+0x8dc): undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
main.o:main.cpp:(.text+0x9ad): undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
main.o:main.cpp:(.text+0xa7e): undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
main.o:main.cpp:(.text+0xbd8): undefined reference to `sf::RenderWindow::setActive(bool)'
main.o:main.cpp:(.text+0xc57): undefined reference to `sf::Image::Image()'
main.o:main.cpp:(.text+0xc6b): undefined reference to `sf::Image::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)&#39;
main.o:main.cpp:(.text+0xc8e): undefined reference to `sf::Image::getPixelsPtr() const&#39;
main.o:main.cpp:(.text+0xc9d): undefined reference to `sf::Image::getSize() const&#39;
main.o:main.cpp:(.text+0xcac): undefined reference to `sf::Image::getSize() const&#39;
main.o:main.cpp:(.text+0xcc1): undefined reference to `sf::Window::setIcon(unsigned int, unsigned int, unsigned char const*)&#39;
main.o:main.cpp:(.text+0xcd1): undefined reference to `sf::Clock::Clock()&#39;
main.o:main.cpp:(.text+0xcde): undefined reference to `sf::Clock::Clock()&#39;
main.o:main.cpp:(.text+0xcf1): undefined reference to `sf::Window::pollEvent(sf::Event&)&#39;
main.o:main.cpp:(.text+0xd45): undefined reference to `sf::Mouse::setPosition(sf::Vector2<int> const&, sf::Window const&)&#39;
main.o:main.cpp:(.text+0xd51): undefined reference to `sf::Window::isOpen() const&#39;
main.o:main.cpp:(.text+0xd6c): undefined reference to `sf::Window::pollEvent(sf::Event&)&#39;
main.o:main.cpp:(.text+0xda5): undefined reference to `sf::Window::close()&#39;
main.o:main.cpp:(.text+0xefd): undefined reference to `sf::Mouse::setPosition(sf::Vector2<int> const&, sf::Window const&)&#39;
main.o:main.cpp:(.text+0x11df): undefined reference to `gluPerspective@32&#39;
main.o:main.cpp:(.text+0x1254): undefined reference to `gluLookAt@72&#39;
main.o:main.cpp:(.text+0x1409): undefined reference to `sf::RenderTarget::pushGLStates()&#39;
main.o:main.cpp:(.text+0x1416): undefined reference to `sf::Clock::getElapsedTime() const&#39;
main.o:main.cpp:(.text+0x1426): undefined reference to `sf::Time::asMicroseconds() const&#39;
main.o:main.cpp:(.text+0x145e): undefined reference to `sf::Clock::getElapsedTime() const&#39;
main.o:main.cpp:(.text+0x146e): undefined reference to `sf::Time::asMicroseconds() const&#39;
main.o:main.cpp:(.text+0x14fb): undefined reference to `sf::Color::White&#39;
main.o:main.cpp:(.text+0x152e): undefined reference to `sf::Clock::restart()&#39;
main.o:main.cpp:(.text+0x1538): undefined reference to `sf::RenderTarget::popGLStates()&#39;
main.o:main.cpp:(.text+0x1542): undefined reference to `sf::Window::display()&#39;
main.o:main.cpp:(.text+0x1559): undefined reference to `sf::Image::~Image()&#39;
main.o:main.cpp:(.text+0x1592): undefined reference to `sf::Image::~Image()&#39;
main.o:main.cpp:(.text+0x15c0): undefined reference to `sf::Font::Font()&#39;
main.o:main.cpp:(.text+0x15d3): undefined reference to `sf::Font::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)&#39;
main.o:main.cpp:(.text+0x15e3): undefined reference to `sf::Text::Text()&#39;
main.o:main.cpp:(.text+0x15f9): undefined reference to `sf::Text::setFont(sf::Font const&)&#39;
main.o:main.cpp:(.text+0x161d): undefined reference to `sf::String::String(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::locale const&)&#39;
main.o:main.cpp:(.text+0x1633): undefined reference to `sf::Text::setString(sf::String const&)&#39;
main.o:main.cpp:(.text+0x165d): undefined reference to `sf::Text::setCharacterSize(unsigned int)&#39;
main.o:main.cpp:(.text+0x1673): undefined reference to `sf::Text::setFillColor(sf::Color const&)&#39;
main.o:main.cpp:(.text+0x1690): undefined reference to `sf::Text::setStyle(unsigned int)&#39;
main.o:main.cpp:(.text+0x16ca): undefined reference to `sf::Transformable::setPosition(float, float)&#39;
main.o:main.cpp:(.text+0x16d5): undefined reference to `sf::RenderStates::Default&#39;
main.o:main.cpp:(.text+0x16e8): undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)&#39;
main.o:main.cpp:(.text+0x170a): undefined reference to `sf::Font::~Font()&#39;
main.o:main.cpp:(.text+0x1755): undefined reference to `sf::Font::~Font()&#39;
main.o:main.cpp:(.text+0x17c8): undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)&#39;
main.o:main.cpp:(.text+0x1808): undefined reference to `sf::Transformable::setPosition(float, float)&#39;
main.o:main.cpp:(.text+0x181e): undefined reference to `sf::Shape::setFillColor(sf::Color const&)&#39;
main.o:main.cpp:(.text+0x1829): undefined reference to `sf::RenderStates::Default&#39;
main.o:main.cpp:(.text+0x183c): undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)&#39;
main.o:main.cpp:(.text+0x190d): undefined reference to `sf::Shape::setFillColor(sf::Color const&)&#39;
main.o:main.cpp:(.text+0x1947): undefined reference to `sf::Transformable::setPosition(float, float)&#39;
main.o:main.cpp:(.text+0x1952): undefined reference to `sf::RenderStates::Default&#39;
main.o:main.cpp:(.text+0x1965): undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)&#39;
main.o:main.cpp:(.text+0x19f4): undefined reference to `sf::Music::Music()&#39;
main.o:main.cpp:(.text+0x1a07): undefined reference to `sf::Music::openFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)&#39;
main.o:main.cpp:(.text+0x1a17): undefined reference to `sf::SoundStream::play()&#39;
main.o:main.cpp:(.text+0x1a24): undefined reference to `sf::Music::getDuration() const&#39;
main.o:main.cpp:(.text+0x1a34): undefined reference to `sf::Time::asMilliseconds() const&#39;
main.o:main.cpp:(.text+0x1a51): undefined reference to `sf::Music::~Music()&#39;
main.o:main.cpp:(.text+0x1a66): undefined reference to `sf::Music::~Music()&#39;
main.o:main.cpp:(.text+0x1ac5): undefined reference to `sf::SoundBuffer::SoundBuffer()&#39;
main.o:main.cpp:(.text+0x1ad5): undefined reference to `sf::SoundBuffer::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)&#39;
main.o:main.cpp:(.text+0x1ae2): undefined reference to `sf::Sound::Sound()&#39;
main.o:main.cpp:(.text+0x1af2): undefined reference to `sf::Sound::setBuffer(sf::SoundBuffer const&)&#39;
main.o:main.cpp:(.text+0x1aff): undefined reference to `sf::Sound::play()&#39;
main.o:main.cpp:(.text+0x1b1d): undefined reference to `sf::Sound::~Sound()&#39;
main.o:main.cpp:(.text+0x1b27): undefined reference to `sf::SoundBuffer::~SoundBuffer()&#39;
main.o:main.cpp:(.text+0x1b39): undefined reference to `sf::Sound::~Sound()&#39;
main.o:main.cpp:(.text+0x1b49): undefined reference to `sf::SoundBuffer::~SoundBuffer()&#39;
main.o:main.cpp:(.text+0x231c): undefined reference to `sf::RenderWindow::~RenderWindow()&#39;
main.o:main.cpp:(.text+0x2477): undefined reference to `sf::Color::Color()&#39;
main.o:main.cpp:(.text+0x24e8): undefined reference to `sf::String::String(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::locale const&)&#39;
main.o:main.cpp:(.text+0x2512): undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)&#39;
main.o:main.cpp:(.text+0x254a): undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)&#39;
main.o:main.cpp:(.text$_ZN10game_world5voxelC1Ev[__ZN10game_world5voxelC1Ev]+0x1c): undefined reference to `sf::Color::Color()&#39;
main.o:main.cpp:(.rdata$_ZTVN3crd8SquircleE[__ZTVN3crd8SquircleE]+0x10): undefined reference to `sf::Shape::draw(sf::RenderTarget&, sf::RenderStates) const&#39;
main.o:main.cpp:(.text$_ZN3crd8SquircleD1Ev[__ZN3crd8SquircleD1Ev]+0x24): undefined reference to `sf::Shape::~Shape()&#39;
main.o:main.cpp:(.rdata$_ZTVN3crd9RoundRectE[__ZTVN3crd9RoundRectE]+0x10): undefined reference to `sf::Shape::draw(sf::RenderTarget&, sf::RenderStatmain.o:main.cpp:(.text$_ZN3crd9RoundRectD1Ev[__ZN3crd9RoundRectD1Ev]+0x24): undefined reference to `sf::Shape::~Shape()&#39;
main.o:main.cpp:(.text$_ZN2sf11VertexArrayD1Ev[__ZN2sf11VertexArrayD1Ev]+0xa): undefined reference to `vtable for sf::VertexArray&#39;
main.o:main.cpp:(.text$_ZN2sf4TextD1Ev[__ZN2sf4TextD1Ev]+0xa): undefined reference to `vtable for sf::Text&#39;
main.o:main.cpp:(.text$_ZN2sf4TextD1Ev[__ZN2sf4TextD1Ev]+0x14): undefined reference to `vtable for sf::Text&#39;
main.o:main.cpp:(.text$_ZN2sf4TextD1Ev[__ZN2sf4TextD1Ev]+0x54): undefined reference to `sf::Transformable::~Transformable()&#39;
main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0xa): undefined reference to `vtable for sf::CircleShape&#39;
main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0x14): undefined reference to `vtable for sf::CircleShape&#39;
main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0x24): undefined reference to `sf::Shape::~Shape()&#39;
collect2.exe: error: ld returned 1 exit status


G.

  • Hero Member
  • *****
  • Posts: 1592
    • View Profile
Re: Can't compile project
« Reply #1 on: July 17, 2023, 10:03:10 am »
You didn't link the freetype dependency, not sure if that's the only problem.

 

anything