Can't use the FLTK library with Microsoft Visual C++ 2013.

390 views
Skip to first unread message

MeSI2014

unread,
Dec 4, 2014, 6:26:19 PM12/4/14
to fltkg...@googlegroups.com

Hi

 

I've successfully compiled the FLTK library using Microsoft Visual C++ 2013.

 

When attempting to compile this simple demo:


#include <FL/Fl.h>

#include <FL/Fl_Box.H>

#include <FL/Fl_Window.h>

int main(){

 

Fl_Window window(200, 200, "Window title");

Fl_Box box(0, 0, 200, 200, "Hello World");

window.show();

return Fl::run();

}

 

I get error C1083: Can't open include file 'X11/Xlocale.h', and X11/Xlib.h

The problem header file is; fl_utf8.h, it seems to have its defines mixed up.

 

How can I fix this, so that I can use the library?

Ian MacArthur

unread,
Dec 5, 2014, 10:09:54 AM12/5/14
to fltkg...@googlegroups.com
What version of fltk are you using?

Others report using 1.3.3 with VS2013 and it works (though has exposed some interesting features with how MS compute the window borders in some cases on Win8 and some Win7 cases...)

How did you build the lib and the project?

You need to be asserting the define WIN32 in your build environment, or fltk will default to X11 mode (which appears to be what has happened here.)

Now the older MS compilers used to assert WIN32, but they don’t seem to any more, though they still set _WIN32 and others.

So, make sure that WIN32 is defined in your build environment, and then things ought to be fine.

Probably...




Albrecht Schlosser

unread,
Dec 5, 2014, 10:25:11 AM12/5/14
to fltkg...@googlegroups.com
On 05.12.2014 00:26, MeSI2014 wrote:

> I've successfully compiled the FLTK library using Microsoft Visual C++ 2013.

Fine.

> When attempting to compile this simple demo:
> [... demo code removed ...]
> I get error C1083: Can't open include file 'X11/Xlocale.h', and X11/Xlib.h
>
> The problem header file is; fl_utf8.h, it seems to have its defines
> mixed up.
>
> How can I fix this, so that I can use the library?

Take a look at the included documentation, in this case the file
README.MSWindows.txt. You will find a chapter "HOW TO BUILD FLTK USING
VISUAL STUDIO 2010". You managed to do this already. Now read the
paragraph "Creating new Projects"...

As Ian said, the main problem is that you need to define WIN32 in your
compiler definitions, but there are also a few libraries you must link
your application with. If you can't find all the needed information,
take a look at the link libraries in the FLTK project definitions.

MeSI2014

unread,
Dec 6, 2014, 12:04:46 AM12/6/14
to fltkg...@googlegroups.com


Thanks for the guidance and help guys, I'll try that out …

Reply all
Reply to author
Forward
0 new messages