Hi

I have Microsoft Visual C++ 2008 Express Edition and I downloaded fltk from fltk.org. When I tried compiling it, i got many of these errors:

LINK : fatal error LNK1181: cannot open input file 'fltk.lib'

How do i compile FLTK now? Please help

Dani AI

Generated

— the compiler errors are from using the wrong FLTK identifiers and header names. FLTK class names and APIs use the prefix "Fl" (capital F, lowercase l), not "FL". C++ is case‑sensitive, so FL_Window and FL::run() are different from the real FLTK names (Fl_Window and Fl::run()); that is why the compiler reports the class as undeclared.

A minimal corrected example (shows the proper names and headers):

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

int main() {
    Fl_Window win(400, 200);
    win.show();
    return Fl::run();
}

If the headers still are not found or the program later fails at link time, verify the project settings as suggested: add the FLTK include directory to Project → C/C++ → Additional Include Directories, and add the FLTK library folder to Linker → Additional Library Directories. Add the correct library name to Linker → Additional Dependencies — typically fltk.lib for Release and fltkd.lib for Debug (ensure the FLTK build configuration matches the application build). Also confirm the headers being included are the ones from the FLTK installation that was actually built, not an empty or stray file with the same path.

Tying back to ’s point: the FLTK docs show the exact header and class names and the common Win32 build quirks (Debug vs Release libs). Fixing the identifier casing and the include/library paths will resolve the “undeclared identifier” compile errors and prevent the earlier LNK1181 linker problem from recurring.

Recommended Answers

All 4 Replies

Try reading the documentation on how to install it perhaps?

Check your linker settings, make sure you have entered everything correctly.

I read the directions in the documentation, and I followed the directions, but it didn't work, it still gave me the same error.

My linker settings seem to be ok...

In your linker settings have you typed in the complete path to where fltk.lib is located ? By default it'll look for it in the current project directory. If fltk.lib is something you are supposed to compile also, then make sure that project is added as a dependency for your current project, so that it compiles before, and fltk.lib exists for you to use.

thanks, stilllearning and William. I got FLTK compiled, but when I try to compile and run the following program, I get the error messages under that.

#include <FL/FL.h>
#include <FL/FL_Window.h>

int main() {
    FL_Window win(400, 200);
    win.show();
    return FL::run();
}

Error messages:
error C2065: 'FL_Window' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'win'
error C3861: 'win': identifier not found
error C2065: 'win' : undeclared identifier
error C2228: left of '.show' must have class/struct/union

sorry if the answer is obvious, I am new to C++ :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.