我正在使用Qt Creator(不使用任何Qt庫)來測試FLTK2.0的Hello World項目。但我得到這樣的錯誤:在Windows中鏈接FLTK 2.0中的錯誤
Errors: UpBox.cxx:-1: error: undefined reference to
[email protected]' UpBox.cxx:-1: error: undefined reference to
[email protected]' UpBox.cxx:-1: error: undefined reference to[email protected]' UpBox.cxx:-1: error: undefined reference to
[email protected]' UpBox.cxx:-1: error: undefined reference to[email protected]' :-1: error: C:\Users\mypc\Desktop\FLTK\fltk-2.0-win-bin\lib/libfltk2.a(UpBox.o): bad reloc address 0xb in section
.text$_ZN4fltk7FlatBoxD1Ev[__ZN4fltk7FlatBoxD1Ev]'
的main.cpp的文件如下:
#include <fltk/Window.h>
#include <fltk/Widget.h>
#include <fltk/run.h>
using namespace fltk;
int main(int argc, char **argv) {
Window *window = new Window(300, 180);
window->begin();
Widget *box = new Widget(20, 40, 260, 100, "Hello, World!");
box->box(UP_BOX);
box->labelfont(HELVETICA_BOLD_ITALIC);
box->labelsize(36);
box->labeltype(SHADOW_LABEL);
window->end();
window->show(argc, argv);
return run();
}
的hello.pro文件:
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp
CONFIG+= c++11
LIBS += -L"C:\\Users\\mypc\\Desktop\\FLTK\\fltk-2.0-win-bin\\lib" -lfltk2
INCLUDEPATH += "C:\\Users\\mypc\\Desktop\\FLTK\\fltk-2.0-win-bin\\include"
DEPENDPATH += "C:\\Users\\mypc\\Desktop\\FLTK\\fltk-2.0-win-bin\\include"
我爲什麼得到這些錯誤?
n.b:在FLTK 2.O的MinGW編譯的二進制文件從FLTK Windows binaries
你使用哪種編譯器? – 2014-09-05 06:58:29
如果您搜索例如'CreatePatternBrush'你應該很快找到[這個鏈接](http://msdn.microsoft.com/en-us/library/dd183508%28v=vs.85%29.aspx),它告訴你你需要什麼* system *庫與之聯繫。 – 2014-09-05 07:00:55
我正在使用MinGW(mingw482_32)@Sergey – user1659459 2014-09-05 07:03:08