Experience with FLTK and MS Visual Studio 10 Express (free version)

End May 2011

As a newby this is the information I really would liked to
have had in one place:

I am using Window 7 Pro on a 6 core AMD Phenom w/ 8G ram.

Get MS Visual Studio 10 Express from Microsoft install and
update as needed (about 2 hours)

Get FLTK source version.  I got fltk-1.3.0rc6 and unpacked
it using 7-Zip File manager to c:\a\fltk-1.3.0rc6.

Following the instructions in the video and README.MSWindows.txt
I built FLTK with static libraries.  This actually worked.

http://seriss.com/people/erco/fltk-videos/

I did not move the includes (FL) or the libs but left
them as built.

I discovered the file vcvars32.bat in VC++ and added the directory
(for me C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin)
to my path.

Whatever shell you use, run the batch file to set additional
path links and other environment variables in the shell session
you are going to use to build FLTK examples.  I use TakeCommand 7
now long since out of print.

Copy the following make file (named Makefile) into the working dir
you want to use.  Modify it as needed.

-------------------------------------------------------------------

###
### Simple FLTK Makefile for Visual Studio Express 2010
###
#
# In fluid, use shell command:
#   nmake hello && hello && exit || pause && exit 2>&1
#
FLTKDIR=C:/a/fltk-1.3.0rc6
VCINC="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include"
VCLIB="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib"
VCLIBS="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib"
CXX=cl
CXXFLAGS=/MD /TP /nologo /DWIN32 /EHsc /I$(FLTKDIR) /I$(VCINC)
# uncomment one below for console or no console if windows code
# CONSOLE adds a console and WINDOWS suppresses it
CXXLINKOPT=/SUBSYSTEM:CONSOLE
#CXXLINKOPT=/SUBSYSTEM:WINDOWS
LIBS=/link $(FLTKDIR)\\lib\\fltk.lib \
           $(VCLIBS)\\wsock32.lib \
           $(VCLIBS)\\winspool.lib \
           $(VCLIBS)\\comctl32.lib \
           $(VCLIBS)\\kernel32.lib \
           $(VCLIBS)\\user32.lib \
           $(VCLIBS)\\gdi32.lib \
           $(VCLIBS)\\shell32.lib \
           $(VCLIBS)\\comdlg32.lib \
           $(VCLIBS)\\advapi32.lib \
           $(VCLIBS)\\odbc32.lib \
           $(VCLIBS)\\odbccp32.lib \
           $(VCLIBS)\\uuid.lib \
           $(VCLIBS)\\ole32.lib \
           $(VCLIBS)\\oleaut32.lib \
           $(VCLIB)\\msvcrt.lib \
           $(VCLIB)\\msvcprt.lib \
           $(VCLIB)\\oldnames.lib
.SUFFIXES: .cxx .obj .exe
.cxx.exe:
        $(CXX) $(CXXFLAGS) $*.cxx $(LIBS) $(CXXLINKOPT)

hello: hello.exe

clean:
        -del *.obj > NULL
        -del *.exe > NULL

-------------------------------------------------------------------

This program in the test branch named hello.cxx

..
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>

int main(int argc, char **argv) {
  Fl_Window *window = new Fl_Window(340,180);
  Fl_Box *box = new Fl_Box(20,40,300,100,"Hello, World!");
  box->box(FL_UP_BOX);
  box->labelfont(FL_BOLD+FL_ITALIC);
  box->labelsize(36);
  box->labeltype(FL_SHADOW_LABEL);
  window->end();
  window->show(argc, argv);
  return Fl::run();
}
..
can now be made with

nmake hello

and run with

hello

If run from say double clicking in an explorer window it
will have a console.  The make file can be changed as the
comments show to supress this.

Building using VC++ IDE also works but the working dir is filled
to the brim with large number of files.  Hello.cxx grew
to something like 12M of data from the IDE but less than 400K
with nmake.  The IDE isn't something I want to spend a
lot of time learning.

I moved a copy of fluid.exe to a place in my tree where
I keep tools on my default path.  Using the same
Makefile I was able to completely follow the video.

(Fluid 'new' menu didn't function as I expected but I
did a save as and restarted fluid and all was fine.)

The makefile can also build and run examples from Al Steven's
learning C++ book.

Now I have an up to date FLTK that I can refresh with
new versions, and a lightweight development method.

So many thanks to the FLTK development team!


_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to