hi . this is for testing Read event in Dev-C++ from there
:http://seriss.com/people/erco/fltk/#Fl_Browser
and when i compile it i have flowing error
SOURCE:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <FL/fl_draw.H>
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Slider.H>
#include <FL/Fl_Menu_Window.H>
#include <FL/Fl_Tooltip.H>
// FLOATING TIP WINDOW
class TipWin : public Fl_Menu_Window {
char tip[40];
public:
TipWin():Fl_Menu_Window(1,1) { // will autosize
strcpy(tip, "X.XX");
set_override();
end();
}
void draw() {
draw_box(FL_BORDER_BOX, 0, 0, w(), h(), Fl_Color(175));
fl_color(FL_BLACK);
fl_font(labelfont(), labelsize());
fl_draw(tip, 3, 3, w()-6, h()-6, Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_WRAP));
}
void value(float f) {
sprintf(tip, "%.2f", f);
// Recalc size of window
fl_font(labelfont(), labelsize());
int W = w(), H = h();
fl_measure(tip, W, H, 0);
W += 8;
size(W, H);
redraw();
}
};
// VALUE SLIDER WITH FLOATING TIP WINDOW
class MyValueSlider : public Fl_Slider {
TipWin *tipwin;
void value_cb2() {
tipwin->value(value());
tipwin->position(Fl::event_x_root(), Fl::event_y_root()+20);
}
static void value_cb(Fl_Widget*, void*data) {
MyValueSlider *val = (MyValueSlider*)data;
val->value_cb2();
}
public:
MyValueSlider(int x,int y,int w,int h,const char*l=0):Fl_Slider(x,y,w,h,l) {
type(FL_HOR_SLIDER);
callback(value_cb, (void*)this);
Fl_Group *save = Fl_Group::current(); // save current widget..
tipwin = new TipWin(); // ..because this trashes it
tipwin->hide();
Fl_Group::current(save); // ..then back to previous.
}
int handle(int e) {
switch(e) {
case FL_PUSH:
// XXX: if offscreen, move tip ABOVE mouse instead
tipwin->position(Fl::event_x_root(), Fl::event_y_root()+20);
tipwin->value(value());
tipwin->show();
break;
case FL_HIDE: // valuator goes away
case FL_RELEASE: // release mouse
case FL_LEAVE: // leave focus
// Make sure tipwin closes when app closes
tipwin->hide();
break;
}
return(Fl_Slider::handle(e));
}
};
int main() {
Fl_Double_Window *win = new Fl_Double_Window(640, 100);
MyValueSlider *val1 = new MyValueSlider(20,20,200,30);
MyValueSlider *val2 = new MyValueSlider(20,50,200,30);
win->show();
return(Fl::run());
}
And ERROR::
g++.exe -c Untitled1.cpp -o Untitled1.o
-I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"
-I"C:/Dev-Cpp/include/c++/3.4.2/backward"
-I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2"
-I"C:/Dev-Cpp/include"
g++.exe Untitled1.o Project1_private.res -o "Project1.exe" -L"C:/Dev-Cpp/lib"
-mwindows -lfltk -lole32 -luuid -lcomctl32 -lwsock32 -lm
C:/Dev-Cpp/lib/libfltk.a(Fl_Browser.o)(.data$_ZTI9Fl_Slider[typeinfo for
Fl_Slider]+0x0):Fl_Browser.cxx: multiple definition of `typeinfo for Fl_Slider'
Untitled1.o(.rdata$_ZTI9Fl_Slider[typeinfo for Fl_Slider]+0x0):Untitled1.cpp:
first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Browser.o)(.text$_ZTS9Fl_Slider[typeinfo name for
Fl_Slider]+0x0):Fl_Browser.cxx: multiple definition of `typeinfo name for
Fl_Slider'
Untitled1.o(.rdata$_ZTS9Fl_Slider[typeinfo name for
Fl_Slider]+0x0):Untitled1.cpp: first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Browser.o)(.data$_ZTI11Fl_Valuator[typeinfo for
Fl_Valuator]+0x0):Fl_Browser.cxx: multiple definition of `typeinfo for
Fl_Valuator'
Untitled1.o(.rdata$_ZTI11Fl_Valuator[typeinfo for
Fl_Valuator]+0x0):Untitled1.cpp: first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Browser.o)(.data$_ZTI8Fl_Group[typeinfo for
Fl_Group]+0x0):Fl_Browser.cxx: multiple definition of `typeinfo for Fl_Group'
Untitled1.o(.rdata$_ZTI8Fl_Group[typeinfo for Fl_Group]+0x0):Untitled1.cpp:
first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Browser.o)(.text$_ZTS8Fl_Group[typeinfo name for
Fl_Group]+0x0):Fl_Browser.cxx: multiple definition of `typeinfo name for
Fl_Group'
Untitled1.o(.rdata$_ZTS8Fl_Group[typeinfo name for
Fl_Group]+0x0):Untitled1.cpp: first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Browser.o)(.data$_ZTI9Fl_Widget[typeinfo for
Fl_Widget]+0x0):Fl_Browser.cxx: multiple definition of `typeinfo for Fl_Widget'
Untitled1.o(.rdata$_ZTI9Fl_Widget[typeinfo for Fl_Widget]+0x0):Untitled1.cpp:
first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Browser.o)(.text$_ZTS11Fl_Valuator[typeinfo name
for Fl_Valuator]+0x0):Fl_Browser.cxx: multiple definition of `typeinfo name for
Fl_Valuator'
Untitled1.o(.rdata$_ZTS11Fl_Valuator[typeinfo name for
Fl_Valuator]+0x0):Untitled1.cpp: first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Browser.o)(.text$_ZTS9Fl_Widget[typeinfo name for
Fl_Widget]+0x0):Fl_Browser.cxx: multiple definition of `typeinfo name for
Fl_Widget'
Untitled1.o(.rdata$_ZTS9Fl_Widget[typeinfo name for
Fl_Widget]+0x0):Untitled1.cpp: first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Menu_Window.o)(.data$_ZTI14Fl_Menu_Window[typeinfo
for Fl_Menu_Window]+0x0):Fl_Menu_Window.cxx: multiple definition of `typeinfo
for Fl_Menu_Window'
Untitled1.o(.rdata$_ZTI14Fl_Menu_Window[typeinfo for
Fl_Menu_Window]+0x0):Untitled1.cpp: first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Menu_Window.o)(.data$_ZTI16Fl_Single_Window[typeinfo
for Fl_Single_Window]+0x0):Fl_Menu_Window.cxx: multiple definition of
`typeinfo for Fl_Single_Window'
Untitled1.o(.rdata$_ZTI16Fl_Single_Window[typeinfo for
Fl_Single_Window]+0x0):Untitled1.cpp: first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Menu_Window.o)(.text$_ZTS16Fl_Single_Window[typeinfo
name for Fl_Single_Window]+0x0):Fl_Menu_Window.cxx: multiple definition of
`typeinfo name for Fl_Single_Window'
Untitled1.o(.rdata$_ZTS16Fl_Single_Window[typeinfo name for
Fl_Single_Window]+0x0):Untitled1.cpp: first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Menu_Window.o)(.data$_ZTI9Fl_Window[typeinfo for
Fl_Window]+0x0):Fl_Menu_Window.cxx: multiple definition of `typeinfo for
Fl_Window'
Untitled1.o(.rdata$_ZTI9Fl_Window[typeinfo for Fl_Window]+0x0):Untitled1.cpp:
first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Menu_Window.o)(.text$_ZTS14Fl_Menu_Window[typeinfo
name for Fl_Menu_Window]+0x0):Fl_Menu_Window.cxx: multiple definition of
`typeinfo name for Fl_Menu_Window'
Untitled1.o(.rdata$_ZTS14Fl_Menu_Window[typeinfo name for
Fl_Menu_Window]+0x0):Untitled1.cpp: first defined here
C:/Dev-Cpp/lib/libfltk.a(Fl_Menu_Window.o)(.text$_ZTS9Fl_Window[typeinfo name
for Fl_Window]+0x0):Fl_Menu_Window.cxx: multiple definition of `typeinfo name
for Fl_Window'
Untitled1.o(.rdata$_ZTS9Fl_Window[typeinfo name for
Fl_Window]+0x0):Untitled1.cpp: first defined here
collect2: ld returned 1 exit status
make.exe: *** [Project1.exe] Error 1
Execution terminated
I think FLTK does't work in DEV-C++
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk