Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

FLTK Problem

Altera_Forum
Honored Contributor II
1,439 Views

Hi~ 

 

Fltk can run. 

I Change my my Makefile to do it. 

Thank pcfantasy and Kazuyasu. 

 

Tingming 

 

 

 

My Makefile 

 

--- Quote Start ---  

 

 

EXEC = feverscan_gui 

OBJS = main.o 

 

 

MICROLIB = ~/nios2-linux/uClinux-dist/user/microwin 

INC = -I .. 

INC += -I $(MICROLIB)/nxlib/fltk-1.1.8rc3 

# INC += -I $(MICROLIB)/nxlib/fltk-1.1.8rc3/FL 

LIB += -L $(MICROLIB)/nxlib/fltk-1.1.8rc3/lib 

LIB += -L $(MICROLIB)/src/lib 

LIB += -L $(MICROLIB)/nxlib/nxlib-0.45 

LDLIBS += -lfltk -lnx11 -lnano-X -lpthread -lm 

 

all: $(EXEC) 

 

$(EXEC): $(OBJS) 

nios2-linux-gnu-g++ -o $(EXEC) $(OBJS) $(LDLIBS) $(LIB) 

 

romfs: 

$(ROMFSINST) /bin/$(EXEC) 

 

clean: 

-rm -f $(EXEC) *.elf *.gdb *.o 

 

main.o: main.cxx setup.cxx 

nios2-linux-gnu-g++ $(INC) -c main.cxx setup.cxx 

 

 

--- Quote End ---  

My setup.h 

 

--- Quote Start ---  

 

// generated by Fast Light User Interface Designer (fluid) version 1.0108 

 

# ifndef setup_h 

# define setup_h 

# include <FL/Fl.H> 

# include <FL/Fl_Window.H> 

# include <FL/Fl_Group.H> 

# include <FL/Fl_Input.H> 

# include <FL/Fl_Spinner.H> 

# include <FL/Fl_Box.H> 

# include <FL/Fl_Button.H> 

# include <FL/Fl_Value_Output.H> 

 

class GuiWindow : public Fl_Window { 

void _GuiWindow(); 

public: 

GuiWindow(int X, int Y, int W, int H, const char *L = 0); 

GuiWindow(int W, int H, const char *L = 0); 

Fl_Group *Tab_1; 

Fl_Input *height0; 

Fl_Input *width0; 

Fl_Input *width1; 

Fl_Input *width2; 

Fl_Input *width3; 

Fl_Spinner *height1; 

Fl_Spinner *height2; 

Fl_Spinner *height3; 

Fl_Group *Tab_2; 

Fl_Group *Tab_3; 

Fl_Button *Tab1; 

Fl_Button *Tab2; 

Fl_Button *Tab3; 

Fl_Value_Output *IntensityShowBox; 

Fl_Value_Output *TempatureShowBox; 

}; 

# endif 

 

--- Quote End ---  

My setup.cxx 

 

--- Quote Start ---  

 

// generated by Fast Light User Interface Designer (fluid) version 1.0108 

 

# include "setup.h" 

# include<stdio.h> 

# include<stdlib.h> 

GuiWindow::GuiWindow(int X, int Y, int W, int H, const char *L) 

: Fl_Window(X, Y, W, H, L) { 

_GuiWindow(); 

 

GuiWindow::GuiWindow(int W, int H, const char *L) 

: Fl_Window(0, 0, W, H, L) { 

clear_flag(16); 

_GuiWindow(); 

 

void GuiWindow::_GuiWindow() { 

this->box(FL_UP_BOX); 

this->color((Fl_Color)220); 

this->selection_color(FL_BACKGROUND_COLOR); 

this->labeltype(FL_NO_LABEL); 

this->labelfont(0); 

this->labelsize(14); 

this->labelcolor(FL_FOREGROUND_COLOR); 

this->align(FL_ALIGN_TOP); 

this->when(FL_WHEN_NEVER); 

{ Tab_1 = new Fl_Group(150, 35, 500, 150); 

Tab_1->box(FL_PLASTIC_UP_FRAME); 

Tab_1->color((Fl_Color)132); 

Tab_1->selection_color((Fl_Color)220); 

Tab_1->labelcolor(FL_BLACK); 

Tab_1->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); 

Tab_1->when(FL_WHEN_NEVER); 

{ height0 = new Fl_Input(215, 45, 120, 25, "height0 :"); 

height0->type(5); 

height0->box(FL_PLASTIC_THIN_DOWN_BOX); 

} // Fl_Input* height0 

{ width0 = new Fl_Input(440, 45, 120, 25, "width0 :"); 

width0->type(5); 

} // Fl_Input* width0 

{ width1 = new Fl_Input(440, 77, 120, 25, "width1 :"); 

width1->type(2); 

} // Fl_Input* width1 

{ width2 = new Fl_Input(440, 105, 120, 25, "width2 :"); 

width2->type(5); 

} // Fl_Input* width2 

{ width3 = new Fl_Input(440, 135, 120, 25, "width3 :"); 

width3->type(1); 

} // Fl_Input* width3 

{ height1 = new Fl_Spinner(215, 75, 120, 25, "height1 :"); 

height1->maximum(100000); 

height1->value(1); 

} // Fl_Spinner* height1 

{ height2 = new Fl_Spinner(215, 105, 120, 25, "height2 :"); 

height2->maximum(100000); 

height2->value(1); 

} // Fl_Spinner* height2 

{ height3 = new Fl_Spinner(215, 135, 120, 25, "height3 :"); 

height3->maximum(100000); 

height3->value(1); 

} // Fl_Spinner* height3 

Tab_1->end(); 

} // Fl_Group* Tab_1 

{ Tab_2 = new Fl_Group(150, 35, 500, 150); 

Tab_2->box(FL_PLASTIC_UP_FRAME); 

Tab_2->color(FL_MAGENTA); 

Tab_2->selection_color((Fl_Color)220); 

Tab_2->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); 

Tab_2->when(FL_WHEN_NEVER); 

Tab_2->hide(); 

{ Fl_Box* o = new Fl_Box(150, 35, 500, 150, "label2"); 

o->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); 

} // Fl_Box* o 

Tab_2->end(); 

} // Fl_Group* Tab_2 

{ Tab_3 = new Fl_Group(150, 35, 500, 150); 

Tab_3->box(FL_PLASTIC_UP_FRAME); 

Tab_3->color((Fl_Color)80); 

Tab_3->selection_color((Fl_Color)220); 

Tab_3->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); 

Tab_3->when(FL_WHEN_NEVER); 

Tab_3->hide(); 

{ Fl_Box* o = new Fl_Box(150, 35, 500, 150, "label3"); 

o->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); 

} // Fl_Box* o 

Tab_3->end(); 

} // Fl_Group* Tab_3 

{ Tab1 = new Fl_Button(150, 15, 70, 20, "Tab 1"); 

Tab1->box(FL_PLASTIC_UP_BOX); 

Tab1->color((Fl_Color)48); 

} // Fl_Button* Tab1 

{ Tab2 = new Fl_Button(220, 15, 70, 20, "Tab 2"); 

Tab2->box(FL_PLASTIC_UP_BOX); 

} // Fl_Button* Tab2 

{ Tab3 = new Fl_Button(290, 15, 70, 20, "Tab 3"); 

Tab3->box(FL_PLASTIC_UP_BOX); 

} // Fl_Button* Tab3 

{ IntensityShowBox = new Fl_Value_Output(30, 75, 100, 25); 

IntensityShowBox->maximum(300); 

IntensityShowBox->value(180); 

} // Fl_Value_Output* IntensityShowBox 

{ TempatureShowBox = new Fl_Value_Output(30, 110, 100, 25); 

TempatureShowBox->maximum(100); 

TempatureShowBox->value(37.6); 

} // Fl_Value_Output* TempatureShowBox 

clear_border(); 

end(); 

resizable(this); 

 

--- Quote End ---  

My main.cxx 

 

--- Quote Start ---  

 

# include <stdio.h>  

# include <stdlib.h> 

# include "setup.cxx" 

# include <unistd.h> 

# include <pthread.h>  

# include <string.h> 

# include <fcntl.h> 

# include <termios.h> 

 

GuiWindow *g; 

 

static void loop_tab2(void*) 

 

int main(int argc, char **argv) { 

GuiWindow *gw ; 

 

Fl::visual(FL_RGB); 

gw = new GuiWindow(0,0,1365,200); 

 

gw->show(); 

g = gw; 

g->Tab_1->hide(); 

g->Tab_2->hide(); 

g->Tab_3->hide(); 

 

return Fl::run();  

 

--- Quote End ---  

0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
740 Views

//#include "setup.cxx" 

 

put setup.cxx in setup.h 

 

try it.
0 Kudos
Altera_Forum
Honored Contributor II
740 Views

Hi, 

 

 

--- Quote Start ---  

 

I try to build a GUI Interface using FLTK. 

I have a code which can run on nios-linux nommu version(20090730) 

However, I can't use the same code in MMU version(20100621) 

I think the problem is my Makefile, 

I can't involve all the libraries. 

Compiler will generate (cannot find -lfltk, -lnano-x, -lX11) 

 

--- Quote End ---  

 

 

Maybe you need dynamic link libraries 'libnano-x.so', 'libX11.so' and so on. You can make 'libX11.so' in the folder 'nios2-linux/uClinux-dist/user/microwin/nxlib/nxlib-0.45'. And please refer my post. 

http://www.alteraforum.com/forum/showpost.php?p=74596&postcount=13 

 

Kazu
0 Kudos
Reply