#ifndef
MY_WINDOW_H |
#include
"MyWindow.h" |
#include
<Fl/Fl.h> |
We've now got all the code we need and we almost ready to build our project but first we must tell VS03 where to find the FLTK files that we are using. We must tell it where to find the header files (*.h) that we've included in our project, such as Fl.h. It also need to know where to find the FLTK library that we've built for you. Choose Tools -> Options from the VS03 menus and you should get the dialog to the right. In the left hand pane go to Projects -> VC++ Directories, then choose Include Files from the Show directories for drop down box. This is a list of directories the VS03 will search for header files when you include them between < and >, such as #include <Fl/Fl.h>. We've placed a copy of all FLTK headers in P:\course\cs559-schenney\public\packages\fltk-1.1.4. So select the new folder button (the yellow folder) and either browse to this directory or copy and paste it in. |
|
We now need to tell VS03 where to find the pre-built fltk libraries. Select Library Files from the Show directories for drop down box and add P:\course\cs559-schenney\public\packages\fltk-1.1.4\lib to the top of the list. We've now set the include and library paths in VS03. This setting will persist through all projects, hence you only need to set this once. All future 559 projects will be able to find FLTK headers and libraries in these directories. Click OK. |
Now that VS03 knows where to find the FLTK library we need to tell it which libraries we're interested in. Unlike the include and library paths this must be done each time you create a project that needs them. Open the Class View window, right click on our project (CS559 Tutorial), and choose Properties. Make sure Configuration is set to Debug and Choose Linker -> Input from the left hand pane. Add fltkd.lib comctl32.lib wsock32.lib to the Additional Dependencies. Make sure the libraries are separated by whitespace. fltkd.lib is the debug library for FLTK. We always use debug builds for this course for simplicity. comctl32.lib and wsock32.lib are Microsoft Windows libraries which FLTK depends on. |
|
One final setting for the FLTK library. The FLTK library uses a debug version of the C runtime from a dll (dynamically linked library). What does that mean? It means the FLTK library loads the basic C library in a different way they the default VS03 project so we need to change our project to match FLTK. Choose C/C++ -> Code Generation from the left hand pane and set the Runtime Library to Multi-threaded Debug DLL (/MDd). Click OK. |
We build our program just like before. Choose Build -> Build Solution. Your project should build with no errors (you can safely ignore the warnings). If you have some errors see where they are and find the difference between your code and the code supplied with this tutorial. Fix the errors and try again. One its built you can run it via Debug -> Start Without Debugging. You should get a gray window like this one. What's that? All this for a gray window? Don't worry we'll actually start doing something with our window in the next tutorial. |