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

Author Topic: undefined reference in Code::Blocks with TDM 4.8.1 x64  (Read 2183 times)

0 Members and 1 Guest are viewing this topic.

ercarlitosg

  • Newbie
  • *
  • Posts: 5
    • View Profile
undefined reference in Code::Blocks with TDM 4.8.1 x64
« on: April 16, 2014, 09:00:32 pm »
Hello to all.I am making an application with sfml and I try to compile the example with codeblocks but I got 20 undefined reference to.I am using codeblocks 13.12 and the tdm suited with this version,the 4.8.1 x64.

So I downloaded the x64 package for windows of sfml and I got this while trying to compile the example:

Quote
-------------- Clean: Debug in Barco (compiler: GNU GCC Compiler test)---------------

Cleaned "Barco - Debug"

-------------- Build: Debug in Barco (compiler: GNU GCC Compiler test)---------------

g++.exe -Wall -fexceptions -g -IC:\SFML-2.1\include -c "C:\Users\Carlos\Documents\CodeBlocks Projects\Barco\Barco\main.cpp" -o obj\Debug\main.o
g++.exe -LC:\SFML-2.1\lib -o bin\Debug\Barco.exe obj\Debug\main.o   -lsfml-graphics-d -lsfml-window-d -lsfml-system-d
obj\Debug\main.o: In function `main':
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:5: undefined reference to `_imp___ZN2sf6StringC1EPKcRKSt6locale'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:5: undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:5: undefined reference to `_imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:6: undefined reference to `_imp___ZN2sf11CircleShapeC1Efj'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:7: undefined reference to `_imp___ZN2sf5Color5GreenE'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:7: undefined reference to `_imp___ZN2sf5Shape12setFillColorERKNS_5ColorE'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:15: undefined reference to `_imp___ZN2sf6Window5closeEv'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:12: undefined reference to `_imp___ZN2sf6Window9pollEventERNS_5EventE'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:18: undefined reference to `_imp___ZN2sf5ColorC1Ehhhh'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:18: undefined reference to `_imp___ZN2sf12RenderTarget5clearERKNS_5ColorE'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:19: undefined reference to `_imp___ZN2sf12RenderStates7DefaultE'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:19: undefined reference to `_imp___ZN2sf12RenderTarget4drawERKNS_8DrawableERKNS_12RenderStatesE'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:20: undefined reference to `_imp___ZN2sf6Window7displayEv'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:9: undefined reference to `_imp___ZNK2sf6Window6isOpenEv'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:23: undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:23: undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:23: undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'
obj\Debug\main.o: In function `ZN2sf11CircleShapeD1Ev':
C:/SFML-2.1/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `_imp___ZTVN2sf11CircleShapeE'
C:/SFML-2.1/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `_imp___ZTVN2sf11CircleShapeE'
C:/SFML-2.1/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `_imp___ZN2sf5ShapeD2Ev'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
20 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 
Thanks

EDIT:

If I put SFML_STATIC this is what I get
Quote
-------------- Clean: Debug in Barco (compiler: GNU GCC Compiler)---------------

Cleaned "Barco - Debug"

-------------- Build: Debug in Barco (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions -DSFML_STATIC -g -IC:\SFML-2.1\include -c "C:\Users\Carlos\Documents\CodeBlocks Projects\Barco\Barco\main.cpp" -o obj\Debug\main.o
mingw32-g++.exe -LC:\SFML-2.1\lib -o bin\Debug\Barco.exe obj\Debug\main.o   -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-d
obj\Debug\main.o: In function `main':
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:5: undefined reference to `sf::String::String(char const*, std::locale const&)'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:5: undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:5: undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:6: undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:7: undefined reference to `sf::Color::Green'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:7: undefined reference to `sf::Shape::setFillColor(sf::Color const&)'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:15: undefined reference to `sf::Window::close()'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:12: undefined reference to `sf::Window::pollEvent(sf::Event&)'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:18: undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:18: undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:19: undefined reference to `sf::RenderStates::Default'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:19: undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:20: undefined reference to `sf::Window::display()'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:9: undefined reference to `sf::Window::isOpen() const'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:23: undefined reference to `sf::RenderWindow::~RenderWindow()'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:23: undefined reference to `sf::RenderWindow::~RenderWindow()'
C:/Users/Carlos/Documents/CodeBlocks Projects/Barco/Barco/main.cpp:23: undefined reference to `sf::RenderWindow::~RenderWindow()'
obj\Debug\main.o: In function `ZN2sf11CircleShapeD1Ev':
C:/SFML-2.1/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `vtable for sf::CircleShape'
C:/SFML-2.1/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `vtable for sf::CircleShape'
C:/SFML-2.1/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `sf::Shape::~Shape()'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
20 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 
« Last Edit: April 16, 2014, 09:08:24 pm by ercarlitosg »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: undefined reference in Code::Blocks with TDM 4.8.1 x64
« Reply #1 on: April 16, 2014, 09:11:04 pm »
You need to recompile SFML since there's no official package for TDM 4.8.x x64.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

ercarlitosg

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: undefined reference in Code::Blocks with TDM 4.8.1 x64
« Reply #2 on: April 16, 2014, 09:16:19 pm »
OH Sorry!
I read on codeblocks download page that tdm gcc is x64 and it is x86.Also thanks