Coder Social home page Coder Social logo

fluid's Introduction

fltk-rs

Documentation Crates.io License Build

Rust bindings for the FLTK Graphical User Interface library.

The fltk crate is a cross-platform lightweight gui library which can be statically linked to produce small, self-contained and fast gui applications.

Resources:

Why choose FLTK?

  • Lightweight. Small binary, around 1mb after stripping. Small memory footprint.
  • Speed. Fast to install, fast to build, fast at startup and fast at runtime.
  • Single executable. No DLLs to deploy.
  • Supports old architectures.
  • FLTK's permissive license which allows static linking for closed-source applications.
  • Themeability (5 supported schemes: Base, GTK, Plastic, Gleam and Oxy), and additional theming using fltk-theme.
  • Provides around 80 customizable widgets.
  • Has inbuilt image support.

Here is a list of software using FLTK. For software using fltk-rs, check here.

  • Link to the official FLTK repository.
  • Link to the official documentation.

Usage

Just add the following to your project's Cargo.toml file:

[dependencies]
fltk = "^1.4"

To use the latest changes in the repo:

[dependencies]
fltk = { version = "^1.4", git = "https://github.com/fltk-rs/fltk-rs" }

Or if you have other depenendencies which depend on fltk-rs:

[dependencies]
fltk = "^1.4"

[patch.crates-io]
fltk = { git = "https://github.com/fltk-rs/fltk-rs" }

To use the bundled libs (available for x64 windows (msvc & gnu (msys2-mingw)), x64 & aarch64 linux & macos):

[dependencies]
fltk = { version = "^1.4", features = ["fltk-bundled"] }

The library is automatically built and statically linked to your binary.

An example hello world application:

use fltk::{app, prelude::*, window::Window};

fn main() {
    let app = app::App::default();
    let mut wind = Window::new(100, 100, 400, 300, "Hello from rust");
    wind.end();
    wind.show();
    app.run().unwrap();
}

Another example showing the basic callback functionality:

use fltk::{app, button::Button, frame::Frame, prelude::*, window::Window};

fn main() {
    let app = app::App::default();
    let mut wind = Window::new(100, 100, 400, 300, "Hello from rust");
    let mut frame = Frame::new(0, 0, 400, 200, "");
    let mut but = Button::new(160, 210, 80, 40, "Click me!");
    wind.end();
    wind.show();
    but.set_callback(move |_| frame.set_label("Hello World!")); // the closure capture is mutable borrow to our button
    app.run().unwrap();
}

Please check the examples directory for more examples. You will notice that all widgets are instantiated with a new() method, taking the x and y coordinates, the width and height of the widget, as well as a label which can be left blank if needed. Another way to initialize a widget is using the builder pattern: (The following buttons are equivalent)

use fltk::{button::Button, prelude::*};
let but1 = Button::new(10, 10, 80, 40, "Button 1");

let but2 = Button::default()
    .with_pos(10, 10)
    .with_size(80, 40)
    .with_label("Button 2");

An example of a counter showing use of the builder pattern:

use fltk::{app, button::Button, frame::Frame, prelude::*, window::Window};
fn main() {
    let app = app::App::default();
    let mut wind = Window::default()
        .with_size(160, 200)
        .center_screen()
        .with_label("Counter");
    let mut frame = Frame::default()
        .with_size(100, 40)
        .center_of(&wind)
        .with_label("0");
    let mut but_inc = Button::default()
        .size_of(&frame)
        .above_of(&frame, 0)
        .with_label("+");
    let mut but_dec = Button::default()
        .size_of(&frame)
        .below_of(&frame, 0)
        .with_label("-");
    wind.make_resizable(true);
    wind.end();
    wind.show();
    /* Event handling */
    app.run().unwrap();
}

Alternatively, you can use Flex (for flexbox layouts), Pack or Grid:

use fltk::{app, button::Button, frame::Frame, group::Flex, prelude::*, window::Window};
fn main() {
    let app = app::App::default();
    let mut wind = Window::default().with_size(160, 200).with_label("Counter");
    let mut flex = Flex::default().with_size(120, 140).center_of_parent().column();
    let mut but_inc = Button::default().with_label("+");
    let mut frame = Frame::default().with_label("0");
    let mut but_dec = Button::default().with_label("-");
    flex.end();
    wind.end();
    wind.show();
    app.run().unwrap();
}

Another example:

use fltk::{app, button::Button, frame::Frame, group::Flex, prelude::*, window::Window};

fn main() {
    let app = app::App::default();
    let mut wind = Window::default().with_size(400, 300);
    let mut col = Flex::default_fill().column();
    col.set_margins(120, 80, 120, 80);
    let mut frame = Frame::default();
    let mut but = Button::default().with_label("Click me!");
    col.fixed(&but, 40);
    col.end();
    wind.end();
    wind.show();

    but.set_callback(move |_| frame.set_label("Hello world"));

    app.run().unwrap();
}

Events

Events can be handled using the set_callback method (as above) or the available fltk::app::set_callback() free function, which will handle the default trigger of each widget(like clicks for buttons):

    /* previous hello world code */
    but.set_callback(move |_| frame.set_label("Hello World!"));
    another_but.set_callback(|this_button| this_button.set_label("Works"));
    app.run().unwrap();

Another way is to use message passing:

    /* previous counter code */
    let (s, r) = app::channel::<Message>();

    but_inc.emit(s, Message::Increment);
    but_dec.emit(s, Message::Decrement);
    
    while app.wait() {
        let label: i32 = frame.label().parse().unwrap();
        if let Some(msg) = r.recv() {
            match msg {
                Message::Increment => frame.set_label(&(label + 1).to_string()),
                Message::Decrement => frame.set_label(&(label - 1).to_string()),
            }
        }
    }

For the remainder of the code, check the full example here.

For custom event handling, the handle() method can be used:

    some_widget.handle(move |widget, ev: Event| {
        match ev {
            Event::Push => {
                println!("Pushed!");
                true
            },
            /* other events to be handled */
            _ => false,
        }
    });

Handled or ignored events using the handle method should return true, unhandled events should return false. More examples are available in the fltk/examples directory.

For an alternative event handling mechanism using an immediate-mode approach, check the fltk-evented crate.

Theming

FLTK offers 5 application schemes:

  • Base
  • Gtk
  • Gleam
  • Plastic
  • Oxy

(Additional theming can be found in the fltk-theme crate)

These can be set using the App::with_scheme() method.

let app = app::App::default().with_scheme(app::Scheme::Gleam);

Themes of individual widgets can be optionally modified using the provided methods in the WidgetExt trait, such as set_color(), set_label_font(), set_frame() etc:

    some_button.set_color(Color::Light1); // You can use one of the provided colors in the fltk enums
    some_button.set_color(Color::from_rgb(255, 0, 0)); // Or you can specify a color by rgb or hex/u32 value
    some_button.set_color(Color::from_u32(0xffebee));
    some_button.set_frame(FrameType::RoundUpBox);
    some_button.set_font(Font::TimesItalic);

For default application colors, fltk-rs provides app::background(), app::background2() and app::foreground(). You can also specify the default application selection/inactive colors, font, label size, frame type, scrollbar size, menu line-spacing. Additionally the fltk-theme crate offers some other predefined color maps (dark theme, tan etc) and widget themes which can be loaded into your application.

Build Dependencies

Rust (version > 1.63), CMake (version > 3.15), Git and a C++17 compiler need to be installed and in your PATH for a cross-platform build from source. Ninja is recommended, but not required. This crate also offers a bundled form of fltk on selected x86_64 and aarch64 platforms (Windows (msvc and gnu), MacOS, Linux), this can be enabled using the fltk-bundled feature flag as mentioned in the usage section (this requires curl and tar to download and unpack the bundled libraries).

  • Windows:
    • MSVC: Windows SDK
    • Gnu: No dependencies
  • MacOS: No dependencies.
  • Linux/BSD: X11 and OpenGL development headers need to be installed for development. The libraries themselves are normally available on linux/bsd distros with a graphical user interface.

For Debian-based GUI distributions, that means running:

sudo apt-get install libx11-dev libxext-dev libxft-dev libxinerama-dev libxcursor-dev libxrender-dev libxfixes-dev libpango1.0-dev libgl1-mesa-dev libglu1-mesa-dev

For RHEL-based GUI distributions, that means running:

sudo yum groupinstall "X Software Development" && sudo yum install pango-devel libXinerama-devel libstdc++-static

For Arch-based GUI distributions, that means running:

sudo pacman -S libx11 libxext libxft libxinerama libxcursor libxrender libxfixes pango cairo libgl mesa --needed

For Alpine linux:

apk add pango-dev fontconfig-dev libxinerama-dev libxfixes-dev libxcursor-dev mesa-gl

For NixOS (Linux distribution) this nix-shell environment can be used:

nix-shell --packages rustc cmake git gcc xorg.libXext xorg.libXft xorg.libXinerama xorg.libXcursor xorg.libXrender xorg.libXfixes libcerf pango cairo libGL mesa pkg-config

Runtime Dependencies

  • Windows: None
  • MacOS: None
  • Linux: You need X11 libraries, as well as pango and cairo for drawing (and OpenGL if you want to enable the enable-glwindow feature):
apt-get install -qq --no-install-recommends libx11-6 libxinerama1 libxft2 libxext6 libxcursor1 libxrender1 libxfixes3 libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libpangoxft-1.0-0 libglib2.0-0 libfontconfig1 libglu1-mesa libgl1

Note that if you installed the build dependencies, it will also install the runtime dependencies automatically as well.

Also note that most graphical desktop environments already have these libs already installed. This list can be useful if you want to test your already built package in CI/docker (where there is no graphical user interface).

Features

The following are the features offered by the crate:

  • use-ninja: Uses the ninja build system if available for a faster build, especially on Windows.
  • no-pango: Build without pango support on Linux/BSD, if rtl/cjk font support is not needed.
  • fltk-bundled: Support for bundled versions of cfltk and fltk on selected platforms (requires curl and tar)
  • enable-glwindow: Support for drawing using OpenGL functions.
  • system-libpng: Uses the system libpng
  • system-libjpeg: Uses the system libjpeg
  • system-zlib: Uses the system zlib
  • use-wayland: Uses FLTK's wayland hybrid backend (runs on wayland when present, and on X11 when not present). Requires libwayland-dev, wayland-protocols, libdbus-1-dev, libxkbcommon-dev, libgtk-3-dev (optional, for the GTK-style titlebar), in addition to the X11 development packages. Sample CI.
  • fltk-config: Uses an already installed FLTK's fltk-config to build this crate against. This still requires FLTK 1.4. Useful for reducing build times, testing against a locally built FLTK and doesn't need to invoke neither git nor cmake.

FAQ

please check the FAQ page for frequently asked questions, encountered issues, guides on deployment, and contribution.

Building

To build, just run:

git clone https://github.com/fltk-rs/fltk-rs --recurse-submodules
cd fltk-rs
cargo build

Currently implemented types:

Image types:

  • SharedImage
  • BmpImage
  • JpegImage
  • GifImage
  • AnimGifImage
  • PngImage
  • SvgImage
  • Pixmap
  • RgbImage
  • XpmImage
  • XbmImage
  • PnmImage
  • TiledImage

Widgets:

  • Buttons
    • Button
    • RadioButton
    • ToggleButton
    • RoundButton
    • CheckButton
    • LightButton
    • RepeatButton
    • RadioLightButton
    • RadioRoundButton
    • ReturnButton
    • ShortcutButton
  • Dialogs
    • Native FileDialog
    • FileChooser
    • HelpDialog
    • Message dialog
    • Alert dialog
    • Password dialog
    • Choice dialog
    • Input dialog
    • ColorChooser dialog
  • Frame (Fl_Box)
  • Windows
    • Window
    • SingleWindow (single buffered)
    • DoubleWindow (double buffered)
    • MenuWindow
    • OverlayWindow
    • GlWindow (requires the "enable-glwindow" flag)
    • Experimental GlWidgetWindow (requires the "enable-glwindow" flag)
  • Groups
  • Text display widgets
    • TextDisplay
    • TextEditor
    • SimpleTerminal
  • Input widgets
    • Input
    • IntInput
    • FloatInput
    • MultilineInput
    • SecretInput
    • FileInput
  • Output widgets
    • Output
    • MultilineOutput
  • Menu widgets
    • MenuBar
    • MenuItem
    • Choice (dropdown list)
    • SysMenuBar (MacOS menu bar which appears at the top of the screen)
  • Valuator widgets
    • Slider
    • NiceSlider
    • ValueSlider
    • Dial
    • LineDial
    • Counter
    • Scrollbar
    • Roller
    • Adjuster
    • ValueInput
    • ValueOutput
    • FillSlider
    • FillDial
    • HorSlider (Horizontal slider)
    • HorFillSlider
    • HorNiceSlider
    • HorValueSlider
  • Browsing widgets
    • Browser
    • SelectBrowser
    • HoldBrowser
    • MultiBrowser
    • FileBrowser
    • CheckBrowser
  • Miscelaneous widgets
    • Spinner
    • Clock (Round and Square)
    • Chart (several chart types are available)
    • Progress (progress bar)
    • Tooltip
    • InputChoice
    • HelpView
  • Table widgets
  • Trees
    • Tree
    • TreeItem

Drawing primitives

(In the draw module)

Surface types:

  • Printer.
  • ImageSurface.
  • SvgFileSurface.

GUI designer

fltk-rs supports FLUID, the RAD wysiwyg designer for FLTK. Checkout the fl2rust crate and fl2rust template.

Examples

To run the examples:

cargo run --example editor
cargo run --example calculator
cargo run --example calculator2
cargo run --example counter
cargo run --example hello_svg
cargo run --example hello_button
cargo run --example fb
cargo run --example pong
cargo run --example custom_widgets
cargo run --example custom_dial
...

Using custom theming and also FLTK provided default schemes like Gtk:

Different frame types which can be used with many different widgets such as Frame, Button widgets, In/Output widgets...etc.

More interesting examples can be found in the fltk-rs-demos repo. Also a nice implementation of the 7guis tasks can be found here. Various advanced examples can also be found here.

Themes

Additional themes can be found in the fltk-theme crate.

  • screenshots/aero.jpg

  • screenshots/black.jpg

And more...

Extra widgets

This crate exposes FLTK's set of widgets, which are all customizable. Additional custom widgets can be found in the fltk-extras crate.

image

image

ss

image

Tutorials

More videos in the playlist here. Some of the demo projects can be found here.

fluid's People

Contributors

moalyousef avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fluid's Issues

Link error 1120 while running `cargo install fltk-fluid`

What I Did

cargo install fltk-fluid

Failed with 'error: linking with link.exe failed: exit code: 1120'

OS Info

Rust: v1.58.1 stable-x86_64-pc-windows-msvc
Windows: win11
cmake: version 3.22.1
git: version 2.34.1.windows.1

MSVC v142 - VS 2019 C++ x64/x86 build tools
Windows 10 SDK(10.0.19041.0)
also installed:
Windows 11 SDK(10.0.22000.0)
MSVC v141 - VS 2017 C++ x64/x86 build tools

Full Backtrace

❯ cargo install fltk-fluid
Updating sjtu index
Installing fltk-fluid v0.1.6
Compiling fltk-fluid v0.1.6
error: linking with link.exe failed: exit code: 1120
|
= note: "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\link.exe" "/NOLOGO" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.0.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.1.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.10.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.11.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.12.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.13.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.14.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.15.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.2.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.3.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.4.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.5.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.6.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.7.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.8.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.fltk_fluid.bf324184-cgu.9.rcgu.o" "c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.1t26u10gy4m8xjx1.rcgu.o" "/LIBPATH:c:\Users\username\cargo_target_dir\release\deps" "/LIBPATH:c:\Users\username\cargo_target_dir\release\build\fltk-fluid-047f976afc335a5f\out\build" "/LIBPATH:c:\Users\username\cargo_target_dir\release\build\fltk-fluid-047f976afc335a5f\out\build\Release" "/LIBPATH:c:\Users\username\cargo_target_dir\release\build\fltk-fluid-047f976afc335a5f\out\build\lib" "/LIBPATH:c:\Users\username\cargo_target_dir\release\build\fltk-fluid-047f976afc335a5f\out\build\lib\Release" "/LIBPATH:c:\Users\username\cargo_target_dir\release\build\fltk-fluid-047f976afc335a5f\out\lib" "/LIBPATH:c:\Users\username\cargo_target_dir\release\build\fltk-fluid-047f976afc335a5f\out\lib64" "/LIBPATH:c:\Users\username\cargo_target_dir\release\build\fltk-fluid-047f976afc335a5f\out\lib\Release" "/LIBPATH:c:\Users\username\cargo_target_dir\release\build\fltk-fluid-047f976afc335a5f\out\lib64\Release" "/LIBPATH:C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib" "/WHOLEARCHIVE:fltk.lib" "/WHOLEARCHIVE:fltk_images.lib" "/WHOLEARCHIVE:fltk_z.lib" "/WHOLEARCHIVE:fltk_jpeg.lib" "/WHOLEARCHIVE:fltk_png.lib" "/WHOLEARCHIVE:fltk_forms.lib" "/WHOLEARCHIVE:fluid.lib" "gdiplus.lib" "ws2_32.lib" "comctl32.lib" "gdi32.lib" "oleaut32.lib" "ole32.lib" "uuid.lib" "shell32.lib" "advapi32.lib" "comdlg32.lib" "winspool.lib" "user32.lib" "kernel32.lib" "odbc32.lib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd-77c29e3b2a96c9a6.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libpanic_unwind-fac20c79897f2b3d.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd_detect-a900fec85d21ec5f.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librustc_demangle-2803b5471132ab91.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libhashbrown-bd7c3f8e84ab3746.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librustc_std_workspace_alloc-6353ac840b4a82ca.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libunwind-8b22f250a6b6c0c3.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcfg_if-837411c15bbbd755.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\liblibc-6e0180ba426c6f71.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\liballoc-8fee164e10a5c1ee.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librustc_std_workspace_core-433995d9d73cd404.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcore-d681750c6d1718a3.rlib" "C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcompiler_builtins-fd343f19f347f62a.rlib" "kernel32.lib" "ws2_32.lib" "bcrypt.lib" "advapi32.lib" "userenv.lib" "kernel32.lib" "msvcrt.lib" "/NXCOMPAT" "/LIBPATH:C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib" "/OUT:c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.exe" "/OPT:REF,ICF" "/DEBUG" "/NATVIS:C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\intrinsic.natvis" "/NATVIS:C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\liballoc.natvis" "/NATVIS:C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\libcore.natvis" "/NATVIS:C:\Users\username\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\etc\libstd.natvis"
= note: LINK : warning LNK4031: no subsystem specified; CONSOLE assumed
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol png_create_write_struct referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_png(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_png@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(fl_write_png.obj) : error LNK2001: unresolved external symbol png_create_write_struct
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol png_create_info_struct referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_png(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_png@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2001: unresolved external symbol png_create_info_struct
fltk_images.lib(fl_write_png.obj) : error LNK2001: unresolved external symbol png_create_info_struct
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol png_write_end referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_png(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_png@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(fl_write_png.obj) : error LNK2001: unresolved external symbol png_write_end
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol png_destroy_write_struct referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_png(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_png@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(fl_write_png.obj) : error LNK2001: unresolved external symbol png_destroy_write_struct
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol png_set_write_fn referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_png(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_png@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol png_get_io_ptr referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_png(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_png@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2001: unresolved external symbol png_get_io_ptr
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol png_set_rows referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_png(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_png@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol png_set_IHDR referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_png(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_png@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(fl_write_png.obj) : error LNK2001: unresolved external symbol png_set_IHDR
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol png_write_png referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_png(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_png@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol jpeg_std_error referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_jpeg(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_jpeg@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(Fl_JPEG_Image.obj) : error LNK2001: unresolved external symbol jpeg_std_error
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol jpeg_CreateCompress referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_jpeg(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_jpeg@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol jpeg_destroy_compress referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_jpeg(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_jpeg@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol jpeg_set_defaults referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_jpeg(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_jpeg@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol jpeg_start_compress referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_jpeg(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_jpeg@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol jpeg_write_scanlines referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_jpeg(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_jpeg@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(Fl_SVG_File_Surface.obj) : error LNK2019: unresolved external symbol jpeg_finish_compress referenced in function "protected: void __cdecl Fl_SVG_Graphics_Driver::define_rgb_jpeg(class Fl_RGB_Image *,char const *,int,int)" (?define_rgb_jpeg@Fl_SVG_Graphics_Driver@@IEAAXPEAVFl_RGB_Image@@PEBDHH@Z)
fltk_images.lib(Fl_SVG_Image.obj) : error LNK2019: unresolved external symbol gzdopen referenced in function "char * __cdecl svg_inflate(char const *)" (?svg_inflate@@YAPEADPEBD@Z)
fltk_images.lib(fl_images_core.obj) : error LNK2001: unresolved external symbol gzdopen
fltk_images.lib(Fl_SVG_Image.obj) : error LNK2019: unresolved external symbol gzread referenced in function "char * __cdecl svg_inflate(char const *)" (?svg_inflate@@YAPEADPEBD@Z)
fltk_images.lib(fl_images_core.obj) : error LNK2001: unresolved external symbol gzread
fltk_images.lib(Fl_SVG_Image.obj) : error LNK2019: unresolved external symbol gzclose referenced in function "char * __cdecl svg_inflate(char const *)" (?svg_inflate@@YAPEADPEBD@Z)
fltk_images.lib(fl_images_core.obj) : error LNK2001: unresolved external symbol gzclose
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_create_read_struct referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_set_longjmp_fn referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_read_info referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_set_expand referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_set_tRNS_to_alpha referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_set_packing referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_set_interlace_handling referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_set_strip_16 referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_read_rows referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_read_end referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_destroy_read_struct referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_init_io referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(fl_write_png.obj) : error LNK2001: unresolved external symbol png_init_io
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_set_read_fn referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_error referenced in function png_read_data_from_mem
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_get_valid referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_get_image_width referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_get_image_height referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_get_bit_depth referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_get_color_type referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_PNG_Image.obj) : error LNK2019: unresolved external symbol png_get_tRNS referenced in function "private: void cdecl Fl_PNG_Image::load_png(char const *,unsigned char const *,int)" (?load_png@Fl_PNG_Image@@AEAAXPEBDPEBEH@Z)
fltk_images.lib(Fl_JPEG_Image.obj) : error LNK2019: unresolved external symbol jpeg_CreateDecompress referenced in function "protected: void cdecl Fl_JPEG_Image::load_jpg(char const *,char const *,unsigned char const *)" (?load_jpg@Fl_JPEG_Image@@IEAAXPEBD0PEBE@Z)
fltk_images.lib(Fl_JPEG_Image.obj) : error LNK2019: unresolved external symbol jpeg_destroy_decompress referenced in function "protected: void cdecl Fl_JPEG_Image::load_jpg(char const *,char const *,unsigned char const *)" (?load_jpg@Fl_JPEG_Image@@IEAAXPEBD0PEBE@Z)
fltk_images.lib(Fl_JPEG_Image.obj) : error LNK2019: unresolved external symbol jpeg_stdio_src referenced in function "protected: void cdecl Fl_JPEG_Image::load_jpg(char const *,char const *,unsigned char const *)" (?load_jpg@Fl_JPEG_Image@@IEAAXPEBD0PEBE@Z)
fltk_images.lib(Fl_JPEG_Image.obj) : error LNK2019: unresolved external symbol jpeg_read_header referenced in function "protected: void cdecl Fl_JPEG_Image::load_jpg(char const *,char const *,unsigned char const *)" (?load_jpg@Fl_JPEG_Image@@IEAAXPEBD0PEBE@Z)
fltk_images.lib(Fl_JPEG_Image.obj) : error LNK2019: unresolved external symbol jpeg_start_decompress referenced in function "protected: void cdecl Fl_JPEG_Image::load_jpg(char const *,char const *,unsigned char const *)" (?load_jpg@Fl_JPEG_Image@@IEAAXPEBD0PEBE@Z)
fltk_images.lib(Fl_JPEG_Image.obj) : error LNK2019: unresolved external symbol jpeg_read_scanlines referenced in function "protected: void cdecl Fl_JPEG_Image::load_jpg(char const *,char const *,unsigned char const *)" (?load_jpg@Fl_JPEG_Image@@IEAAXPEBD0PEBE@Z)
fltk_images.lib(Fl_JPEG_Image.obj) : error LNK2019: unresolved external symbol jpeg_finish_decompress referenced in function "protected: void cdecl Fl_JPEG_Image::load_jpg(char const *,char const *,unsigned char const *)" (?load_jpg@Fl_JPEG_Image@@IEAAXPEBD0PEBE@Z)
fltk_images.lib(Fl_JPEG_Image.obj) : error LNK2019: unresolved external symbol jpeg_calc_output_dimensions referenced in function "protected: void cdecl Fl_JPEG_Image::load_jpg(char const *,char const *,unsigned char const *)" (?load_jpg@Fl_JPEG_Image@@IEAAXPEBD0PEBE@Z)
fltk_images.lib(Fl_JPEG_Image.obj) : error LNK2019: unresolved external symbol jpeg_resync_to_restart referenced in function "protected: void cdecl Fl_JPEG_Image::load_jpg(char const *,char const *,unsigned char const *)" (?load_jpg@Fl_JPEG_Image@@IEAAXPEBD0PEBE@Z)
fltk_images.lib(fl_write_png.obj) : error LNK2019: unresolved external symbol png_write_info referenced in function "int __cdecl fl_write_png(char const *,char const *,int,int,int,int)" (?fl_write_png@@YAHPEBD0HHHH@Z)
fltk_images.lib(fl_write_png.obj) : error LNK2019: unresolved external symbol png_write_row referenced in function "int __cdecl fl_write_png(char const *,char const *,int,int,int,int)" (?fl_write_png@@YAHPEBD0HHHH@Z)
fltk_images.lib(fl_write_png.obj) : error LNK2019: unresolved external symbol png_set_sRGB referenced in function "int cdecl fl_write_png(char const *,char const *,int,int,int,int)" (?fl_write_png@@YAHPEBD0HHHH@Z)
fltk_png.lib(pngwutil.obj) : error LNK2019: unresolved external symbol deflate referenced in function fltk_png_compress_IDAT
fltk_png.lib(pngwutil.obj) : error LNK2019: unresolved external symbol deflateEnd referenced in function png_deflate_claim
fltk_png.lib(pngwrite.obj) : error LNK2001: unresolved external symbol deflateEnd
fltk_png.lib(pngwutil.obj) : error LNK2019: unresolved external symbol deflateReset referenced in function png_deflate_claim
fltk_png.lib(pngwutil.obj) : error LNK2019: unresolved external symbol deflateInit2
referenced in function png_deflate_claim
fltk_png.lib(pngrutil.obj) : error LNK2019: unresolved external symbol inflate referenced in function fltk_png_read_IDAT_data
fltk_png.lib(pngrutil.obj) : error LNK2019: unresolved external symbol inflateReset referenced in function png_decompress_chunk
fltk_png.lib(png.obj) : error LNK2001: unresolved external symbol inflateReset
fltk_png.lib(pngrutil.obj) : error LNK2019: unresolved external symbol inflateReset2 referenced in function png_inflate_claim
fltk_png.lib(pngrutil.obj) : error LNK2019: unresolved external symbol inflateInit2
referenced in function png_inflate_claim
fltk_png.lib(pngrutil.obj) : error LNK2019: unresolved external symbol inflateValidate referenced in function png_inflate_claim
fltk_png.lib(pngread.obj) : error LNK2019: unresolved external symbol inflateEnd referenced in function fltk_png_destroy_read_struct
fltk_png.lib(png.obj) : error LNK2019: unresolved external symbol adler32 referenced in function png_compare_ICC_profile_with_sRGB
fltk_png.lib(png.obj) : error LNK2019: unresolved external symbol crc32 referenced in function fltk_png_calculate_crc
c:\Users\username\cargo_target_dir\release\deps\fltk_fluid-2120ebde4b691069.exe : fatal error LNK1120: 63 unresolved externals

error: failed to compile fltk-fluid v0.1.6, intermediate artifacts can be found at c:\Users\username\cargo_target_dir\

Caused by:
could not compile fltk-fluid due to previous error

mac bookpro m1 failed to run custom build command

cargo install fltk-fluid
Updating crates.io index
Installing fltk-fluid v0.1.9
Compiling libc v0.2.147
Compiling cc v1.0.83
Compiling cmake v0.1.50
Compiling fltk-fluid v0.1.9
error: failed to run custom build command for fltk-fluid v0.1.9

Caused by:
process didn't exit successfully: /var/folders/td/k2dmqky15blg2kx_x8_5bb_m0000gn/T/cargo-installl93O0q/release/build/fltk-fluid-41751a9220ef5666/build-script-build (exit status: 101)
--- stderr
thread 'main' panicked at 'called Result::unwrap() on an Err value: NotPresent', /Users/test/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-fluid-0.1.9/build.rs:6:59
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
error: failed to compile fltk-fluid v0.1.9, intermediate artifacts can be found at /var/folders/td/k2dmqky15blg2kx_x8_5bb_m0000gn/T/cargo-installl93O0q

Windows 10 failed to run a custom build command

OS
Windows 10 Enterprise LTSC

cargo 1.72.1 (103a7ff2e 2023-08-15)
release: 1.72.1
commit-hash: 103a7ff2ee7678d34f34d778614c5eb2525ae9de
commit-date: 2023-08-15
host: x86_64-pc-windows-msvc
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.1.2-DEV (sys:0.4.63+curl-8.1.2 vendored ssl:Schannel)
os: Windows 10.0.19044 (Windows 10 Enterprise LTSC 2021) [64-bit]

Error:
cargo install fltk-fluid
Updating crates.io index
Installing fltk-fluid v0.1.9
Updating crates.io index
Compiling cc v1.0.83
Compiling cmake v0.1.50
Compiling fltk-fluid v0.1.9
error: failed to run custom build command for fltk-fluid v0.1.9

Caused by:
process didn't exit successfully: C:\Users\admin\.cargo\bin\release\build\fltk-fluid-ba221c03046df901\build-script-build (exit code: 101)
--- stdout
cargo:rerun-if-changed=build.rs

--- stderr
thread 'main' panicked at 'Git is needed to retrieve the fltk source files!: Error { kind: NotFound, message: "program not found" }', C:\Users\admin.cargo\registry\src\index.crates.io-6f17d22bba15001f\fltk-fluid-0.1.9\build.rs:15:10
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
error: failed to compile fltk-fluid v0.1.9, intermediate artifacts can be found at C:\Users\admin\.cargo\bin.
To reuse those artifacts with a future compilation, set the environment variable CARGO_TARGET_DIR to that path.

config.toml
[env]
CARGO_TARGET_DIR = 'C:\Users\admin.cargo\bin'

[build]
target-dir = 'C:\Users\admin.cargo\bin'

Segfault

cargo install fltk-fluid
    Updating crates.io index
     Ignored package `fltk-fluid v0.1.3` is already installed, use --force to override
fltk-fluid              
zsh: segmentation fault  fltk-fluid

On Mac OS Big Sur 11.4 on
MacBook Pro (16-inch, 2019)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.