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

Author Topic: [Solved] QTCreator Linker Error  (Read 4087 times)

0 Members and 1 Guest are viewing this topic.

Live-Dimension

  • Newbie
  • *
  • Posts: 2
    • View Profile
[Solved] QTCreator Linker Error
« on: May 11, 2010, 02:53:32 pm »
I've been trying to get SFML and QT to work together over the last few days, but I just can't seem to figure out whats wrong. Pretty much there is a whole bunch of errors on "undefined reference".

I've tried the code on the tutorial site and it's still not working. Yes the paths are relative, this QT Project is apart of a set of apps.

Here is the project file for QT.
Code: [Select]

INCLUDEPATH += ../src
TEMPLATE = app
TARGET = SHUMPEditor

DESTDIR = ..\..\editor-debug

win32:LIBS += "../lib/debug/sfml-audio-s-d.lib" \
"../lib/debug/sfml-graphics-s-d.lib" \
"../lib/debug/sfml-window-s-d.lib" \
"../lib/debug/sfml-system-s-d.lib" \
"../lib/debug/sfml-network-s-d.lib"

#FORMS +=
HEADERS += QSFMLCanvas.h
SOURCES += QSFMLCanvas.cpp \
    main.cpp


The compile log. I took out alot of repeated "undefined reference to bla bla bla"
Code: [Select]
Running build steps for project SHUMPEditor...
Starting: c:/qt/qt/bin/qmake.exe D:/Live-Dimension/Desktop/SHUMP/source/editor/SHUMPEditor.pro -spec win32-g++ -r
Exited with code 0.
Starting: C:/Qt/mingw/bin/mingw32-make.exe -w
mingw32-make: Entering directory `D:/Live-Dimension/Desktop/SHUMP/source/editor'
C:/Qt/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `D:/Live-Dimension/Desktop/SHUMP/source/editor'
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o ..\..\editor-debug\SHUMPEditor.exe debug/QSFMLCanvas.o debug/main.o -L"c:\Qt\qt\lib" -lmingw32 -lqtmaind ../lib/debug/sfml-audio-s-d.lib ../lib/debug/sfml-graphics-s-d.lib ../lib/debug/sfml-window-s-d.lib ../lib/debug/sfml-system-s-d.lib ../lib/debug/sfml-network-s-d.lib -lQtGuid4 -lQtCored4
mingw32-make[1]: Leaving directory `D:/Live-Dimension/Desktop/SHUMP/source/editor'
mingw32-make: Leaving directory `D:/Live-Dimension/Desktop/SHUMP/source/editor'
debug/QSFMLCanvas.o: In function `SFMLCanvas':
D:\Live-Dimension\Desktop\SHUMP\source\editor/QSFMLCanvas.cpp:19: undefined reference to `sf::RenderWindow::RenderWindow()'
D:\Live-Dimension\Desktop\SHUMP\source\editor/QSFMLCanvas.cpp:35: undefined reference to `sf::RenderWindow::~RenderWindow()'
debug/QSFMLCanvas.o: In function `~SFMLCanvas':
D:\Live-Dimension\Desktop\SHUMP\source\editor/QSFMLCanvas.cpp:44: undefined reference to `sf::RenderWindow::~RenderWindow()'
D:\Live-Dimension\Desktop\SHUMP\source\editor/QSFMLCanvas.cpp:44: undefined reference to `sf::RenderWindow::~RenderWindow()'
debug/QSFMLCanvas.o:D:\Live-Dimension\Desktop\SHUMP\source\editor/QSFMLCanvas.cpp:44: more undefined references to `sf::RenderWindow::~RenderWindow()' follow
debug/QSFMLCanvas.o:D:\Live-Dimension\Desktop\SHUMP\source\editor/QSFMLCanvas.cpp:91: undefined reference to `sf::Window::Create(void*, sf::WindowSettings const&)'
debug/QSFMLCanvas.o:D:\Live-Dimension\Desktop\SHUMP\source\editor/QSFMLCanvas.cpp:115: undefined reference to `sf::Window::Display()'
debug/QSFMLCanvas.o:QSFMLCanvas.cpp:(.rdata$_ZTV10SFMLCanvas[vtable for SFMLCanvas]+0x11c): undefined reference to `sf::Window::OnEvent(sf::Event const&)'
debug/QSFMLCanvas.o:QSFMLCanvas.cpp:(.rdata$_ZTV10SFMLCanvas[vtable for SFMLCanvas]+0x128): undefined reference to `sf::RenderWindow::OnCreate()'
debug/QSFMLCanvas.o:QSFMLCanvas.cpp:(.rdata$_ZTV10SFMLCanvas[vtable for SFMLCanvas]+0x14c): undefined reference to `non-virtual thunk to sf::RenderWindow::GetWidth() const'
debug/QSFMLCanvas.o:QSFMLCanvas.cpp:(.rdata$_ZTV10SFMLCanvas[vtable for SFMLCanvas]+0x154): undefined reference to `non-virtual thunk to sf::RenderWindow::Activate(bool)'
debug/main.o: In function `~Sprite':
D:\Live-Dimension\Desktop\SHUMP\source\editor/../src/SFML/Graphics/Sprite.hpp:45: undefined reference to `vtable for sf::Sprite'
D:\Live-Dimension\Desktop\SHUMP\source\editor/../src/SFML/Graphics/Sprite.hpp:45: undefined reference to `sf::Drawable::~Drawable()'
debug/main.o: In function `MyCanvas':
D:\Live-Dimension\Desktop\SHUMP\source\editor/main.cpp:37: undefined reference to `sf::Image::Image()'
D:\Live-Dimension\Desktop\SHUMP\source\editor/main.cpp:40: undefined reference to `sf::Image::~Image()'
debug/main.o:D:\Live-Dimension\Desktop\SHUMP\source\editor/main.cpp:51: undefined reference to `sf::Image::LoadFromFile(std::string const&)'
debug/main.o:D:\Live-Dimension\Desktop\SHUMP\source\editor/main.cpp:68: undefined reference to `sf::Window::GetFrameTime() const'
debug/main.o:D:\Live-Dimension\Desktop\SHUMP\source\editor/main.cpp:68: undefined reference to `sf::Drawable::Rotate(float)'
debug/main.o:main.cpp:(.rdata$_ZTV8MyCanvas[vtable for MyCanvas]+0x11c): undefined reference to `sf::Window::OnEvent(sf::Event const&)'
debug/main.o:main.cpp:(.rdata$_ZTV8MyCanvas[vtable for MyCanvas]+0x128): undefined reference to `sf::RenderWindow::OnCreate()'
debug/main.o:main.cpp:(.rdata$_ZTV8MyCanvas[vtable for MyCanvas]+0x12c): undefined reference to `sf::RenderWindow::GetWidth() const'
debug/main.o:main.cpp:(.rdata$_ZTV8MyCanvas[vtable for MyCanvas]+0x154): undefined reference to `non-virtual thunk to sf::RenderWindow::Activate(bool)'
debug/main.o: In function `~MyCanvas':
D:\Live-Dimension\Desktop\SHUMP\source\editor/main.cpp:29: undefined reference to `sf::Image::~Image()'
...
collect2: ld returned 1 exit status
mingw32-make[1]: *** [..\..\editor-debug\SHUMPEditor.exe] Error 1
mingw32-make: *** [debug] Error 2
Exited with code 2.
Error while building project SHUMPEditor
When executing build step 'Make'


I'd appreciate any help! I've been trying this for 3-4 nights now with no luck. :(

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[Solved] QTCreator Linker Error
« Reply #1 on: May 11, 2010, 03:11:46 pm »
You're using the Visual C++ libraries instead of the MinGW ones.
Laurent Gomila - SFML developer

Live-Dimension

  • Newbie
  • *
  • Posts: 2
    • View Profile
[Solved] QTCreator Linker Error
« Reply #2 on: May 11, 2010, 03:12:46 pm »
Ahh, blast! I should of picked that up!

Thanks!

edit: It works. I kinda forgot about the different kinds of libs, having always been a Visual C++ user! :oops:

Kiecker

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: [Solved] QTCreator Linker Error
« Reply #3 on: June 13, 2016, 03:35:05 am »
Thank you for posting this thread, I didn't know what my error was for a long time

 

anything