2

I have been working on several programming languages like Java and Python and recently I came to C++. I want to build a GUI program and eventually I was suggested to use FLTK, which is claimed to be lightweight and user-friendly. However, what I was told is to install a series of third-party tools, while I still can't figure out how to create a simple GUI application.

I was first told to install an enormous IDE Dev-C++ and download the FLTK source code (obtained here). Then some "tutorials" on the Internet also suggested me install a FLTK package (obtained here), while I couldn't find any tutorials or documentations about how to actually "import" the library (I mean, something like specifying the classpath and import classes in Java). I eventually tried to copy the FLTK source code into the Dev-C++ folder Dev-Cpp\MinGW64\x86_64-w64-mingw32\include, created a FLTK project and started compiling the following code (auto-generated):

/*
** Copyright © YYYY NAME
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU Library General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

/**
   @file main.cpp
   @author NAME
   @date YYYY-MM-DD
   @version 0.01
*/

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

int
main(int argc, char ** argv)
{
    Fl_Window *window;
    Fl_Box *box;

    window = new Fl_Window(300, 180);
    box = new Fl_Box(20, 40, 260, 100, "Hello World!");

    box->box(FL_UP_BOX);
    box->labelsize(36);
    box->labelfont(FL_BOLD+FL_ITALIC);
    box->labeltype(FL_SHADOW_LABEL);
    window->end();
    window->show(argc, argv);

    return(Fl::run());
}

Instead of a successful compilation, what appears is an error message: (copied from the Compile Log)

Compiling single file...
--------
- Filename: C:\C++\GUITest\main.cxx
- Compiler Name: TDM-GCC 4.9.2 32-bit Release

Processing C++ source file...
--------
- C++ Compiler: C:\Program Files\Dev-Cpp\MinGW64\bin\g++.exe
- Command: g++.exe "C:\C++\GUITest\main.cxx" -o "C:\C++\GUITest\main.exe" -m32 -std=c++11 -I"C:\Program Files\Dev-Cpp\MinGW64\include" -I"C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\include" -I"C:\Program Files\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include" -I"C:\Program Files\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++" -L"C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib32" -static-libgcc -m32
In file included from C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/vadefs.h:9:0,
                 from C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/_mingw.h:282,
                 from C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/crtdefs.h:10,
                 from C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/stdio.h:9,
                 from C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/FL/fl_utf8.h:33,
                 from C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/FL/Fl.H:30,
                 from C:\C++\GUITest\main.cxx:26:
C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/_mingw.h:686:33: fatal error: sdks/_mingw_directx.h: No such file or directory
 #include "sdks/_mingw_directx.h"
                                 ^
compilation terminated.

I really don't know how should I proceed. It seems to me that C++ is a support-lacking and undeveloped programming language which really sucks. Please help me, or at least, give me some hints, to create a simple GUI, and correct my misconceptions if there are any. Thanks in advance.

tony_chow
  • 41
  • 4
  • Why on the Earth is it including `sdks/_mingw_directx.h`?? Looks like a problem in the toolchain, not FLTK-related. – DejanLekic May 15 '15 at 11:07
  • @DejanLekic I really don't know where the problem is. Would you have some workarounds? – tony_chow May 15 '15 at 12:31
  • I can't help as I do not have a Windows computer here... I can't bother installing Wine on my Linux box just because of this issue. I would first try to find why compiler tries to include directx header. – DejanLekic May 15 '15 at 12:34
  • 1
    Why not just download either Visual Studio Express or community edition and build using the Microsoft dev environment. Once you've installed the dev env, go to the IDE directory, select one of the VC2010 directory (doesn't matter if you have 2010, 2012, 2013 or 2015). It may say it wants to convert to the new version: let it, and then build. It just builds: no faffing about with missing bits in toolchains. – cup May 17 '15 at 11:05

0 Answers0