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

Author Topic: compiling main.o issue  (Read 162 times)

0 Members and 1 Guest are viewing this topic.

eyad salah

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
compiling main.o issue
« on: December 30, 2023, 08:46:41 am »
when I try to compile a main.o file by typing this long command g++ main.o -o sfml-app -L"C:\Users\SALAH AHMAD\Desktop\إياد\sfml folder\SFML-2.6.1\lib" -lsfml-graphics -lsfml-window -lsfml-system
I receive this output main.o:main.cpp:(.text+0x7c): undefined reference to
`_imp___ZN2sf6StringC1EPKcRKSt6locale'
main.o:main.cpp:(.text+0xa2): undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'
main.o:main.cpp:(.text+0xde): undefined reference to `_imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'
main.o:main.cpp:(.text+0x115): undefined reference to `_imp___ZN2sf11CircleShapeC1Efj'
main.o:main.cpp:(.text+0x126): undefined reference to `_imp___ZN2sf5Color5GreenE'
main.o:main.cpp:(.text+0x130): undefined reference to `_imp___ZN2sf5Shape12setFillColorERKNS_5ColorE'
main.o:main.cpp:(.text+0x142): undefined reference to `_imp___ZNK2sf10WindowBase6isOpenEv'
main.o:main.cpp:(.text+0x162): undefined reference to `_imp___ZN2sf10WindowBase9pollEventERNS_5EventE'
main.o:main.cpp:(.text+0x182): undefined reference to `_imp___ZN2sf6Window5closeEv'
main.o:main.cpp:(.text+0x1af): undefined reference to `_imp___ZN2sf5ColorC1Ehhhh'
main.o:main.cpp:(.text+0x1ca): undefined reference to `_imp___ZN2sf12RenderTarget5clearERKNS_5ColorE'
main.o:main.cpp:(.text+0x1dd): undefined reference to `_imp___ZN2sf12RenderStates7DefaultE'
main.o:main.cpp:(.text+0x1f1): undefined reference to `_imp___ZN2sf12RenderTarget4drawERKNS_8DrawableERKNS_12RenderStatesE'
main.o:main.cpp:(.text+0x203): undefined reference to `_imp___ZN2sf6Window7displayEv'
main.o:main.cpp:(.text+0x229): undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'
main.o:main.cpp:(.text+0x273): undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'
main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0xa): undefined reference to `_imp___ZTVN2sf11CircleShapeE'
main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0x17): undefined reference to `_imp___ZTVN2sf11CircleShapeE'
main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0x2a): undefined reference to `_imp___ZN2sf5ShapeD2Ev'
collect2.exe: error: ld returned 1 exit status
what should I do ?
« Last Edit: December 30, 2023, 11:53:01 am by eXpl0it3r »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: compiling main.o issue
« Reply #1 on: December 30, 2023, 11:58:59 am »
Sounds like your compiler and pre-compiled SFML libraries aren't compatible.
Make sure to use matching compilers or use the SFML CMake Template: https://www.sfml-dev.org/tutorials/2.6/compile-with-cmake.php

Additionally, please spend some time searching the forum and the internet for your problems.
They are not new and you'll find many replies, no need to post any tiny problem you run into.
« Last Edit: December 30, 2023, 12:02:08 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/