0

I've been trying to use FLTK to create a chess program gui, but I can't seem to get the example code they provide on their website to work.

#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, "Bob is 1 million");
    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();
}

I've followed a videothus far trying to get everything working. example error: Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol GdiplusStartup referenced in function "public: static class Fl_Graphics_Driver * __cdecl Fl_Graphics_Driver::newMainGraphicsDriver(void)" (?newMainGraphicsDriver@Fl_Graphics_Driver@@SAPEAV1@XZ) chess C:\Users\esdv\source\repos\chess\fltkd.lib(fl_WinAPI_platform_init.obj) 1

I get 61 of these errors and no warnings at all.

process

I download fltk 1.4.0, unzip it, add build folder, run it through cmake, and open FLTK.sln. It opens fine, and I right click the solution in the solution explorer and click build. Works fine. I then open up my own solution(an empty project with a .cpp file I added) and paste in the example code above. After, I add C:\Users\LBOZO\Desktop\fltk-master to "include directories(config properties > VC++ Dir). I add C:\Users\LBOZO\Desktop\fltk-master\build\lib\Debug to Lib Directories (same place). I add C:\Users\esdv\Desktop\fltk-master\build and C:\Users\esdv\Desktop\fltk-master to Additional Include Dir (C/C++ > General). I add fltkd.lib, fltk_formsd.lib, fltk_jpegd.lib, fltk_imagesd.lib, fltk_gld.lib, fltk_pngd.lib, and fltk_zd.lib to additional dependencies (Linker > Input). Then when I click local windows debugger to run the program, I get the popup message "There were build errors. Would you like to continue and run the last successful build?" I click no, and I get 61 LNK2019 or 2001 errors. Now I'm here.

  • The `d.lib` libraries are for debug mode only. There will be different libs for release. Debug and Release mode are incompatible with each other so you must be careful to use the correct libs. – drescherjm May 18 '23 at 16:21
  • ***get 61 LNK2019 or 2001 errors.*** Copy the exact text of the error messages from the Output Tab (not the errors list) and paste the text into your question. The information in the errors should help you determine exactly which additional libraries are needed. – drescherjm May 18 '23 at 16:24
  • ***unresolved external symbol GdiplusStartup*** This is a microsoft library. Google and msdn will tell you the library you need: [https://learn.microsoft.com/en-us/windows/win32/api/gdiplusinit/nf-gdiplusinit-gdiplusstartup#requirements](https://learn.microsoft.com/en-us/windows/win32/api/gdiplusinit/nf-gdiplusinit-gdiplusstartup#requirements) – drescherjm May 18 '23 at 16:25

0 Answers0