I want to make a hello world with FLTK (CMAKE + MINGW)

83 views
Skip to first unread message

sanal bilgi kösesi

unread,
Aug 18, 2020, 4:42:07 PM8/18/20
to fltk.general
------------------------------------------------------------------------------------------------
#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,"Hello, World!");
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();
}
------------------------------------------------------------------------------------------------
So how can I run this example with CMAKE + MINGW?
Without FindFltk and the information on the internet, none of this worked.

Brian Tilley

unread,
Aug 18, 2020, 5:40:54 PM8/18/20
to fltkg...@googlegroups.com
For a simple single file program like this I'd just use
fltk-config --compile <filename>.cxx 


 

Albrecht Schlosser

unread,
Aug 18, 2020, 5:48:40 PM8/18/20
to fltkg...@googlegroups.com
On 8/18/20 11:40 PM 'Brian Tilley' via fltk.general wrote:
That's true, but if the OP wants to use CMake, for instance as a
learning task to use later, then I recommend to read our
README.CMake[.txt] file which describes this for a simple program.

sanal bilgi kösesi

unread,
Aug 20, 2020, 11:17:38 AM8/20/20
to fltk.general
I found friends thank you
-----------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.5)
project(FLTKexample) 
set(FLTK_DIR C:\\fltk-1.3.5) 
set(FLTK_FLUID_EXECUTABLE C:\\fltk-1.3.5\\fluid) 
set(FLTK_INCLUDE_DIR C:\\fltk-1.3.5\\) 
set(FLTK_LIBRARIES C:\\fltk-1.3.5\\lib) 
find_package(FLTK)
include_directories(${FLTK_INCLUDE_DIR})
set(SOURCES main.cpp ) 
add_executable(${PROJECT_NAME} ${SOURCES}) target_link_libraries(${PROJECT_NAME} ${FLTK_LIBRARIES})
-----------------------------------------------------------------------------------

19 Ağustos 2020 Çarşamba tarihinde saat 00:48:40 UTC+3 itibarıyla Albrecht Schlosser şunları yazdı:
Reply all
Reply to author
Forward
0 new messages