View Full Version : OpenGL and FLTK with Microsoft Visual C++
06-18-2002, 07:04 AM
Does anyone know of a good site that gives explicit step by step instructions on running an FLTK and OpenGL program with Microsoft Visual? The first time that i tried to run my program (a simple demo that maps a bmp image to a polygon and has an FLTK menu that only allows you to click File-Exit) was when including gl/gl.h I got 3 errors at compile time. It claimed I was missing a semicolon in the middle of the header file. I know this file is correct, though, because other programs have run with it. To fix this problem, the FLTK comes with its own fl/gl.h file, so rather than use gl/gl.h i used fl/gl.h. This eliminated the above problem and allowed me to compile the program, but wheN i try to execute it it comes up with close to 40 link errors (I can't remember the lib names that came up). I have followed several onlin tutorials, and am at wits end. The program runs on Linux. I can tinker around with it and get several different sets of errors to come up. Now I am getting "unresolved external symbol."
Also, does anyone know of places online to get detailed information on converting FLTK programs from Linux to Windows?
06-18-2002, 07:31 AM
The original compile errors were probably due to you not including windows.h before gl.h.
The current errors are likely linker errors caused by you not adding opengl32.lib to the project settings. (You said VC++, right? Project->Settings->Link tab->Object/modules)
You may also need to include a library for fltk. Never used that before, so I can't say for sure.
I'm also a bit confused because you mention Microsoft Visual C++, but also say "The program runs on Linux."
Ok, I think I understand what you meant now... you're saying you got it to compile with Linux, and are now trying to get it to compile with VC++?
Adding opengl32.lib like I said above is the equivalent to adding the -lGL command line parameter to gcc. You may also need glu32.lib if you use glu functions. And if you get anything about unresolved _main or _WinMain, then you created the wrong type of project.
I'm sure if you would do a search on this forum for the exact error, you'll find many, many, many, many other people had the same problem and the solution has been mentioned many, many, many, many times.
[This message has been edited by Deiussum (edited 06-18-2002).]
06-18-2002, 08:21 AM
That's precisely what I meant. I wrote this short program on a Linux box to use as part of a short tutorial on how to add FLTK to an existing OpenGL program. But my office (I work at a research facility with students at USM) is going to Windows for various reasons and so we have to make sure evrrything works for both OSes. I copied a few of the errors that I'm getting now and pasted them below. I don't know how well they will show here but it gives a better idea. I have 28 of these sorts of erros (I overestimated last time). Thanks!
emo.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Fl_Window::handle(int)" (?handle@Fl_Window@@UAEHH@Z)
demo.obj : error LNK2001: unresolved external symbol "public: static void __cdecl Fl::redraw(void)" (?redraw@Fl@@SAXXZ)
demo.obj : error LNK2001: unresolved external symbol "char * __cdecl fl_file_chooser(char const *,char const *,char const *,int)" (?fl_file_chooser@@YAPADPBD00H@Z)
demo.obj : error LNK2001: unresolved external symbol "char const * __cdecl fl_shortcut_label(int)" (?fl_shortcut_label@@YAPBDH@Z)
demo.obj : error LNK2001: unresolved external symbol "public: static int __cdecl Fl::run(void)" (?run@Fl@@SAHXZ)
demo.obj : error LNK2001: unresolved external symbol "public: void __thiscall Fl_Menu_::menu(struct Fl_Menu_Item const *)" (?menu@Fl_Menu_@@QAEXPBUFl_Menu_Item@@@Z)
demo.obj : error LNK2001: unresolved external symbol "private: virtual void __thiscall Fl_Gl_Window::draw_overlay(void)" (?draw_overlay@Fl_Gl_Window@@EAEXXZ)
demo.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Fl_Gl_Window::hide(void)" (?hide@Fl_Gl_Window@@UAEXXZ)
demo.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Fl_Gl_Window::show(void)" (?show@Fl_Gl_Window@@UAEXXZ)
demo.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Fl_Gl_Window::flush(void)" (?flush@Fl_Gl_Window@@UAEXXZ)
06-18-2002, 08:30 AM
Also I tried adding the windows.h as well as the opengl32.lib and still was given the above errors. It compiles with no errors and 2 irrelevent warnings, then gives the above errors when you attempt to execute.
06-18-2002, 10:01 AM
Those appear to be linker errors to the FLTK library you are using. You'll need to find out the name of that library, make sure it's in your library search paths, and add that to the same location as you added opengl32.lib.
06-18-2002, 11:55 AM
Have you tried the examples that come with Fltk ?, there are an OpenGL test app included, take a look at the settings for that one and just copy them if it works (the .lib files to use and so on).
If you don't get it to work, then I think you should try to ask at the Fltk forum, they would be in a much better seat to healp you out I think.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.