Fatal error malloc h file not found

BladeRF fails installing with the following error:

#57195

closed


defect


(fixed)

bladeRF @20180927: fatal error: ‘malloc.h’ file not found

Reported by: BitBangingBytes (BitBangingBytes) Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version: 2.5.3
Keywords: Cc:
Port: bladeRF

BladeRF fails installing with the following error:

/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/bladeRF-6737d7b02be1dcb38c1e02ca31e88fe3d99b783a/host/libraries/libbladeRF/src/driver/thirdparty/adi/ad9361.c:44:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^~~~~~~~~~
[ 25%] Building C object host/libraries/libbladeRF/CMakeFiles/libbladerf_shared.dir/src/driver/thirdparty/adi/adc_core.c.o
cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/build/host/libraries/libbladeRF && /usr/bin/clang -DHAVE_LIBUSB_GET_VERSION -DLIBBLADERF_SEARCH_PREFIX="/opt/local" -DLOGGING_ENABLED -DLOG_INCLUDE_FILE_INFO -Dlibbladerf_shared_EXPORTS -DSHORT_FILE_=host/libraries/libbladeRF/src/driver/thirdparty/adi/adc_core.c -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/bladeRF-6737d7b02be1dcb38c1e02ca31e88fe3d99b783a/host/libraries/libbladeRF/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/bladeRF-6737d7b02be1dcb38c1e02ca31e88fe3d99b783a/host/libraries/libbladeRF/src -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/bladeRF-6737d7b02be1dcb38c1e02ca31e88fe3d99b783a/host/common/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/build/host/common/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/bladeRF-6737d7b02be1dcb38c1e02ca31e88fe3d99b783a/host/common/include/osx -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/bladeRF-6737d7b02be1dcb38c1e02ca31e88fe3d99b783a/host/../firmware_common -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/bladeRF-6737d7b02be1dcb38c1e02ca31e88fe3d99b783a/host/../fpga_common/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/build/host/libraries/libbladeRF/src -I/usr/include/malloc -I/opt/local/include/libusb-1.0  -pipe -Os -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -fvisibility=hidden -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.14 -fPIC   -Wall -Wextra -Wno-unused-parameter -std=gnu11 -o CMakeFiles/libbladerf_shared.dir/src/driver/thirdparty/adi/adc_core.c.o   -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/bladeRF-6737d7b02be1dcb38c1e02ca31e88fe3d99b783a/host/libraries/libbladeRF/src/driver/thirdparty/adi/adc_core.c
1 error generated.
make[2]: *** [host/libraries/libbladeRF/CMakeFiles/libbladerf_shared.dir/src/driver/thirdparty/adi/ad9361.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 25%] Building C object host/libraries/libbladeRF/CMakeFiles/libbladerf_shared.dir/src/driver/thirdparty/adi/dac_core.c.o
cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/build/host/libraries/libbladeRF && /usr/bin/clang -DHAVE_LIBUSB_GET_VERSION -DLIBBLADERF_SEARCH_PREFIX="/opt/local" -DLOGGING_ENABLED -DLOG_INCLUDE_FILE_INFO -Dlibbladerf_shared_EXPORTS -DSHORT_FILE_=host/libraries/libbladeRF/src/driver/thirdparty/adi/dac_core.c -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/bladeRF-6737d7b02be1dcb38c1e02ca31e88fe3d99b783a/host/libraries/libbladeRF/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/bladeRF-6737d7b02be1dcb38c1e02ca31e88fe3d99b783a/host/libraries/libbladeRF/src -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/bladeRF-6737d7b02be1dcb38c1e02ca31e88fe3d99b783a/host/common/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/build/host/common/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/bladeRF-6737d7b02be1dcb38c1e02ca31e88fe3d99b783a/host/common/include/osx -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/bladeRF-6737d7b02be1dcb38c1e02ca31e88fe3d99b783a/host/../firmware_common -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/bladeRF-6737d7b02be1dcb38c1e02ca31e88fe3d99b783a/host/../fpga_common/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/build/host/libraries/libbladeRF/src -I/usr/include/malloc -I/opt/local/include/libusb-1.0  -pipe -Os -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -fvisibility=hidden -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.14 -fPIC   -Wall -Wextra -Wno-unused-parameter -std=gnu11 -o CMakeFiles/libbladerf_shared.dir/src/driver/thirdparty/adi/dac_core.c.o   -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/bladeRF-6737d7b02be1dcb38c1e02ca31e88fe3d99b783a/host/libraries/libbladeRF/src/driver/thirdparty/adi/dac_core.c
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/build'
make[1]: *** [host/libraries/libbladeRF/CMakeFiles/libbladerf_shared.dir/all] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/build'
make: *** [all] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/build'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_bladeRF/bladeRF/work/build" && /usr/bin/make -j8 -w all VERBOSE=ON 
Exit code: 2
Warning: The following existing file was hidden from the build system by trace mode:
  /opt
The following files would have been hidden from the build system by trace mode if they existed:
  /usr/gnu/include
  /usr/local/cuda
  /usr/local/cuda-7.0
  /usr/local/cuda-7.5
  /usr/local/cuda-8.0
  /usr/local/include
  /usr/local/lib
Error: Failed to build bladeRF: command execution failed

Attachments (1)

main.log​ (245.4 KB) — added by kencu (Ken) 4 years ago.
bladerf build fail Mojave (no command-line tools installed)

Download all attachments as: .zip

Change History (27)

Description: modified (diff)
Port: bladerf added
Summary: gr-osmosdr fails installing while installing BladeRF
gr-osmosdr @20170704_1 fails while installing BladeRF
Owner: set to BitBangingmichaelld@…
Status: new
assigned
Owner: changed from BitBangingmichaelld@… to michaelld@…
Owner: changed from michaelld@… to michaelld
Port: bladeRF added; bladerf removed
Summary: gr-osmosdr @20170704_1 fails while installing BladeRF
bladeRF @20180927: fatal error: ‘malloc.h’ file not found
Resolution: fixed
Status: assigned
closed

Note: See
TracTickets for help on using
tickets.

  • #1

Hello, I’ve been having a lot of struggles with recent error, which I get outputed when trying to compile with YYC compiler. I wasn’t using yyc so just for a single client testing and now when I got back, I get this strange error… I have visual studio 2017 and 2015 installed, by the instrunctions on yoyo help page and I have tested it with both. Not working…Please help me out, i’m hopeless :(
X://yyc/include/YYStd.h:42:10: fatal error: ‘malloc.h’ file not found
Error output:

HTML:

Build for architecture - x86
In file included from Z:/ServerShoo_526708_41DA964E/ServerShooterProject/default/Scripts/gml_Script_client_edit.gml.cpp:1:
In file included from X://yyc/includeYYGML.h:5:
X://yyc/include/YYStd.h:42:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^
In file included from Z:/ServerShoo_526708_41DA964E/ServerShooterProject/default/Scripts/gml_Script_client_get_info.gml.cpp:1:
In file included from X://yyc/includeYYGML.h:5:
X://yyc/include/YYStd.h:42:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^
In file included from Z:/ServerShoo_526708_41DA964E/ServerShooterProject/default/Scripts/gml_Script_client_create.gml.cpp:1:
In file included from X://yyc/includeYYGML.h:5:
X://yyc/include/YYStd.h:42:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^
1 error generated.
1 error generated.
1 error generated.
In file included from Z:/ServerShoo_526708_41DA964E/ServerShooterProject/default/Scripts/gml_Script_client_destroy.gml.cpp:1:
In file included from X://yyc/includeYYGML.h:5:
X://yyc/include/YYStd.h:42:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^
In file included from Z:/ServerShoo_526708_41DA964E/ServerShooterProject/default/Scripts/gml_Script_client_json_encode.gml.cpp:1:
In file included from X://yyc/includeYYGML.h:5:
X://yyc/include/YYStd.h:42:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^
In file included from Z:/ServerShoo_526708_41DA964E/ServerShooterProject/default/Scripts/gml_Script_send_to_all.gml.cpp:1:
In file included from X://yyc/includeYYGML.h:5:
X://yyc/include/YYStd.h:42:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^
In file included from Z:/ServerShoo_526708_41DA964E/ServerShooterProject/default/Scripts/gml_Script_send_to_all_udp.gml.cpp:1:
In file included from X://yyc/includeYYGML.h:5:
X://yyc/include/YYStd.h:42:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^
1 error generated.
1 error generated.
1 error generated.
1 error generated.

Picture of installed SDK: https://prnt.sc/l6onq4

EDIT: It also does not work with YoYo dungeon, I’ve tested now.. Same error.

EDIT 2: SOLVED: formatted PC :p

Last edited: Oct 16, 2018

SamuelMarks opened this issue 2 years ago · comments

Is your feature request related to a problem? Please describe.

CMakeLists.txt

cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0048 NEW)
project(pp VERSION 0.0.0 LANGUAGES C)

set(src src/main.c)

find_path(NUKLEAR_INCLUDE_DIRS "nuklear.h")

add_executable(${PROJECT_NAME} ${src})
target_include_directories(${PROJECT_NAME} PRIVATE ${NUKLEAR_INCLUDE_DIRS})

src/main.c

#include <nuklear.h>
#include <malloc.h>
#include <allegro5/allegro.h>
#define MAX_MEMORY 1024

int main(void) {
    /* init gui state */
    struct nk_context ctx;
    NkAllegro5Font *font;
    font = nk_allegro5_font_create_from_file("../../../extra_font/Roboto-Regular.ttf", 12, 0);
    nk_init_fixed(&ctx, calloc(1, MAX_MEMORY), MAX_MEMORY, &font);

    enum {EASY, HARD};
    static int op = EASY;
    static float value = 0.6f;
    static int i =  20;

    if (nk_begin(&ctx, "Show", nk_rect(50, 50, 220, 220),
                 NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE)) {
        /* fixed widget pixel width */
        nk_layout_row_static(&ctx, 30, 80, 1);
        if (nk_button_label(&ctx, "button")) {
            /* event handling */
        }

        /* fixed widget window ratio width */
        nk_layout_row_dynamic(&ctx, 30, 2);
        if (nk_option_label(&ctx, "easy", op == EASY)) op = EASY;
        if (nk_option_label(&ctx, "hard", op == HARD)) op = HARD;

        /* custom widget pixel width */
        nk_layout_row_begin(&ctx, NK_STATIC, 30, 2);
        {
            nk_layout_row_push(&ctx, 50);
            nk_label(&ctx, "Volume:", NK_TEXT_LEFT);
            nk_layout_row_push(&ctx, 110);
            nk_slider_float(&ctx, 0, &value, 1.0f, 0.1f);
        }
        nk_layout_row_end(&ctx);
    }
    nk_end(&ctx);
}

shell

$ [path]/vcpkg install nuklear
$ mkdir build && cd $_
$ cmake -DCMAKE_TOOLCHAIN_FILE=~/repos/vcpkg/scripts/buildsystems/vcpkg.cmake ..
$ cmake --build .
/tmp/b/src/main.c:2:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/pp.dir/src/main.c.o] Error 1
make[1]: *** [CMakeFiles/pp.dir/all] Error 2
make: *** [all] Error 2

Proposed solution
Would be nice if the example would build

Describe alternatives you’ve considered

#if defined(macintosh) || defined(Macintosh) || defined(__APPLE__) && defined(__MACH__)
#include <stdlib.h>
#else
#include <malloc.h>
#endif

(but would need to be more careful, there is a list of macros on sourceforge lined up with where to find malloc, so I bunch of these checks are required)

But it could find neither #include "nuklear.h" nor #include <nuklear.h>

The malloc.h is included in your main.cpp, so I think this is not nuklear bug.
Also, you should find allegro5 manually and link to its include path and libraries.

@JackBoosY Okay I tried find_package(allegro REQUIRED) and find_package(allegro5 REQUIRED) then when neither could find the relevant cmake file I tried fd -HIFecmake 'allegro'. All after vcpkg install allegro5. Also tried find_path(ALLEGRO5_INCLUDE_DIRS "allegro5.h") but got a «variables are used in this project, but they are set to NOTFOUND». What’s the trick here? (other vcpkg packages gave me some help text on what I should add to my CMakeLists.txt).

include(FindPackageHandleStandardArgs)
include(SelectLibraryConfigurations)
find_path(ALLEGRO_INCLUDES NAMES allegro.h HINTS ${CURRENT_INSTALLED_DIR} PATH_SUFFIXES allegro5)
find_library(ALLEGRO_LIBRARY_RELEASE NAMES liballegro-static PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH REQUIRED)
find_library(ALLEGRO_LIBRARY_DEBUG NAMES liballegro-debug-static PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH REQUIRED)
select_library_configurations(ALLEGRO)

@JackBoosY Hmm that’s a lot of code that I’m not sure how I was expected to know! — Anyway, it fails with:

Could not find ALLEGRO_LIBRARY_RELEASE using the following names:
liballegro-static

Oh sorry, I forgot to remove the lib prefix. Should be:

include(FindPackageHandleStandardArgs)
include(SelectLibraryConfigurations)
find_path(ALLEGRO_INCLUDES NAMES allegro.h HINTS ${CURRENT_INSTALLED_DIR} PATH_SUFFIXES allegro5)
find_library(ALLEGRO_LIBRARY_RELEASE NAMES allegro-static PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH REQUIRED)
find_library(ALLEGRO_LIBRARY_DEBUG NAMES allegro-debug-static PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH REQUIRED)
select_library_configurations(ALLEGRO)

@JackBoosY Thanks that left #17108 with a fatal error: 'allegro5/allegro.h' file not found… trying now with nuklear.

EDIT: No, nuklear didn’t work either.

cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0048 NEW)
project(pp VERSION 0.0.0 LANGUAGES C)

set(src src/main.c)

find_path(NUKLEAR_INCLUDE_DIRS "nuklear.h")
include(FindPackageHandleStandardArgs)
include(SelectLibraryConfigurations)
find_path(ALLEGRO_INCLUDES NAMES allegro.h HINTS ${CURRENT_INSTALLED_DIR} PATH_SUFFIXES allegro5)
find_library(ALLEGRO_LIBRARY_RELEASE NAMES allegro-static PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH REQUIRED)
find_library(ALLEGRO_LIBRARY_DEBUG NAMES allegro-debug-static PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH REQUIRED)
select_library_configurations(ALLEGRO)

add_executable(${PROJECT_NAME} ${src})
target_include_directories(${PROJECT_NAME} PRIVATE ${ALLEGRO_INCLUDES} ${NUKLEAR_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${ALLEGRO_LIBRARY_DEBUG})

sh

$ cmake -DCMAKE_TOOLCHAIN_FILE=[root]/vcpkg/scripts/buildsystems/vcpkg.cmake ..
-- The C compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/nuklear/build
$ cmake --build .
[ 50%] Building C object CMakeFiles/pp.dir/src/main.c.o
/tmp/nuklear/src/main.c:9:5: error: use of undeclared identifier 'NkAllegro5Font'
    NkAllegro5Font *font;
    ^
/tmp/nuklear/src/main.c:9:21: error: use of undeclared identifier 'font'; did you mean 'for'?
    NkAllegro5Font *font;
                    ^~~~
                    for
/tmp/nuklear/src/main.c:9:21: error: expected expression
/tmp/nuklear/src/main.c:10:5: error: use of undeclared identifier 'font'
    font = nk_allegro5_font_create_from_file("../../../extra_font/Roboto-Regular.ttf", 12, 0);
    ^
/tmp/nuklear/src/main.c:10:12: error: implicit declaration of function 'nk_allegro5_font_create_from_file' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
    font = nk_allegro5_font_create_from_file("../../../extra_font/Roboto-Regular.ttf", 12, 0);
           ^
/tmp/nuklear/src/main.c:11:61: error: use of undeclared identifier 'font'
    nk_init_fixed(&ctx, calloc(1, MAX_MEMORY), MAX_MEMORY, &font);
                                                            ^
6 errors generated.
make[2]: *** [CMakeFiles/pp.dir/src/main.c.o] Error 1
make[1]: *** [CMakeFiles/pp.dir/all] Error 2
make: *** [all] Error 2

Shoud include allegro.h directly: #include <allegro.h>

@JackBoosY Same error. I’m using that src/main.c from the initial post. Even with both #include <allegro.h> and #include <allegro5/allegro.h> the same error occurs.

CMakeLists.txt

cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0048 NEW)
project(pp VERSION 0.0.0 LANGUAGES C)

set(src src/main.c)

find_path(NUKLEAR_INCLUDE_DIRS "nuklear.h")
include(FindPackageHandleStandardArgs)
include(SelectLibraryConfigurations)
find_path(ALLEGRO_INCLUDES NAMES allegro.h HINTS ${CURRENT_INSTALLED_DIR} PATH_SUFFIXES allegro5)
find_library(ALLEGRO_LIBRARY_RELEASE NAMES allegro-static PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH REQUIRED)
find_library(ALLEGRO_LIBRARY_DEBUG NAMES allegro-debug-static PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH REQUIRED)
select_library_configurations(ALLEGRO)

add_executable(${PROJECT_NAME} ${src})
target_include_directories(${PROJECT_NAME} PRIVATE ${ALLEGRO_INCLUDES} ${NUKLEAR_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${ALLEGRO_LIBRARY_DEBUG})

src/main.c

#include <nuklear.h>
#include <malloc.h>
#include <allegro5/allegro.h>
#define MAX_MEMORY 1024

int main(void) {
    /* init gui state */
    struct nk_context ctx;
    NkAllegro5Font *font;
    font = nk_allegro5_font_create_from_file("../../../extra_font/Roboto-Regular.ttf", 12, 0);
    nk_init_fixed(&ctx, calloc(1, MAX_MEMORY), MAX_MEMORY, &font);

    enum {EASY, HARD};
    static int op = EASY;
    static float value = 0.6f;
    static int i =  20;

    if (nk_begin(&ctx, "Show", nk_rect(50, 50, 220, 220),
                 NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE)) {
        /* fixed widget pixel width */
        nk_layout_row_static(&ctx, 30, 80, 1);
        if (nk_button_label(&ctx, "button")) {
            /* event handling */
        }

        /* fixed widget window ratio width */
        nk_layout_row_dynamic(&ctx, 30, 2);
        if (nk_option_label(&ctx, "easy", op == EASY)) op = EASY;
        if (nk_option_label(&ctx, "hard", op == HARD)) op = HARD;

        /* custom widget pixel width */
        nk_layout_row_begin(&ctx, NK_STATIC, 30, 2);
        {
            nk_layout_row_push(&ctx, 50);
            nk_label(&ctx, "Volume:", NK_TEXT_LEFT);
            nk_layout_row_push(&ctx, 110);
            nk_slider_float(&ctx, 0, &value, 1.0f, 0.1f);
        }
        nk_layout_row_end(&ctx);
    }
    nk_end(&ctx);
}

sh

$ /tmp/vcpkg/vcpkg install allegro5 nuklear
$ rm -rf build && mkdir $_ && cd $_
/tmp/nuklear/build $ cmake -DCMAKE_TOOLCHAIN_FILE=/tmp/vcpkg/scripts/buildsystems/vcpkg.cmake ..
-- The C compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/nuklear/build
/tmp/nuklear/build $ cmake --build .
[ 50%] Building C object CMakeFiles/pp.dir/src/main.c.o
/tmp/nuklear/src/main.c:10:5: error: use of undeclared identifier 'NkAllegro5Font'
    NkAllegro5Font *font;
    ^
/tmp/nuklear/src/main.c:10:21: error: use of undeclared identifier 'font'; did you mean 'for'?
    NkAllegro5Font *font;
                    ^~~~
                    for
/tmp/nuklear/src/main.c:10:21: error: expected expression
/tmp/nuklear/src/main.c:11:5: error: use of undeclared identifier 'font'
    font = nk_allegro5_font_create_from_file("../../../extra_font/Roboto-Regular.ttf", 12, 0);
    ^
/tmp/nuklear/src/main.c:11:12: error: implicit declaration of function 'nk_allegro5_font_create_from_file' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
    font = nk_allegro5_font_create_from_file("../../../extra_font/Roboto-Regular.ttf", 12, 0);
           ^
/tmp/nuklear/src/main.c:12:61: error: use of undeclared identifier 'font'
    nk_init_fixed(&ctx, calloc(1, MAX_MEMORY), MAX_MEMORY, &font);
                                                            ^
6 errors generated.
make[2]: *** [CMakeFiles/pp.dir/src/main.c.o] Error 1
make[1]: *** [CMakeFiles/pp.dir/all] Error 2
make: *** [all] Error 2

NkAllegro5Font is defined in nuklear source file _demoallegro5nuklear_allegro5.h _ and we don’t install it.

Hmm so this should work then?

cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0048 NEW)
project(pp VERSION 0.0.0 LANGUAGES C)

set(src src/main.c)

file(DOWNLOAD "https://raw.githubusercontent.com/Immediate-Mode-UI/Nuklear/264abf4/demo/allegro5/nuklear_allegro5.h" "_demo/allegro5/nuklear_allegro5.h"
     EXPECTED_HASH SHA256=7062f21f267ab2e87559c78b4041a6a6afd1a4658e025f1888538e543596f862)


find_path(NUKLEAR_INCLUDE_DIRS "nuklear.h")
include(FindPackageHandleStandardArgs)
include(SelectLibraryConfigurations)
find_path(ALLEGRO_INCLUDES NAMES allegro.h HINTS ${CURRENT_INSTALLED_DIR} PATH_SUFFIXES allegro5)
find_library(ALLEGRO_LIBRARY_RELEASE NAMES allegro-static PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH REQUIRED)
find_library(ALLEGRO_LIBRARY_DEBUG NAMES allegro-debug-static PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH REQUIRED)
select_library_configurations(ALLEGRO)

add_executable(${PROJECT_NAME} ${src})
target_include_directories(${PROJECT_NAME} PRIVATE ${ALLEGRO_INCLUDES} ${NUKLEAR_INCLUDE_DIRS} "${CMAKE_CURRENT_BINARY_DIR}/_demo/allegro5")
target_link_libraries(${PROJECT_NAME} PRIVATE ${ALLEGRO_LIBRARY_DEBUG})

I somehow feel like that NkAllegro5Font symbol should be found in some header that I should be including explicitly, because clearly <allegro5/allegro.h> isn’t doing the trick (and the nuklear guide didn’t tell me to do otherwise).

@SamuelMarks I think we should export these targets so we can easily to use them instead of find each one.

Sounds good, would be great to have a working nuklear via vcpkg (with no special instructions required)

Hi guys, can you please test my PR #18881?

@JackBoosY

CMakeLists.txt

cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0048 NEW)
project(pp VERSION 0.0.0 LANGUAGES C)

set(src src/main.c)

add_executable("${PROJECT_NAME}" "${src}")

find_package(unofficial-nuklear CONFIG REQUIRED)
target_link_libraries("${PROJECT_NAME}" PRIVATE nuklear)

src/main.c

#include <nuklear.h>
//#include <malloc.h>
#include <stdlib.h>
#include <allegro5/allegro.h>
#define MAX_MEMORY 1024

int main(void) {
    /* init gui state */
    struct nk_context ctx;
    NkAllegro5Font *font;
    font = nk_allegro5_font_create_from_file("../../../extra_font/Roboto-Regular.ttf", 12, 0);
    nk_init_fixed(&ctx, calloc(1, MAX_MEMORY), MAX_MEMORY, &font);

    enum {EASY, HARD};
    static int op = EASY;
    static float value = 0.6f;
    static int i =  20;

    if (nk_begin(&ctx, "Show", nk_rect(50, 50, 220, 220),
                 NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE)) {
        /* fixed widget pixel width */
        nk_layout_row_static(&ctx, 30, 80, 1);
        if (nk_button_label(&ctx, "button")) {
            /* event handling */
        }

        /* fixed widget window ratio width */
        nk_layout_row_dynamic(&ctx, 30, 2);
        if (nk_option_label(&ctx, "easy", op == EASY)) op = EASY;
        if (nk_option_label(&ctx, "hard", op == HARD)) op = HARD;

        /* custom widget pixel width */
        nk_layout_row_begin(&ctx, NK_STATIC, 30, 2);
        {
            nk_layout_row_push(&ctx, 50);
            nk_label(&ctx, "Volume:", NK_TEXT_LEFT);
            nk_layout_row_push(&ctx, 110);
            nk_slider_float(&ctx, 0, &value, 1.0f, 0.1f);
        }
        nk_layout_row_end(&ctx);
    }
    nk_end(&ctx);
}

sh

@ bcb1c2a

$ git clone https://github.com/microsoft/vcpkg && cd vcpkg
$ gh pr checkout 18881
$ ./bootstrap-vcpkg.sh
$ ./vcpkg install nuklear
$ mkdir [project_dir]/build && cd "$_"
$ cmake ..
$ cmake --build .
[ 50%] Building C object CMakeFiles/pp.dir/src/main.c.o
test_repos/nuklear/src/main.c:4:10: fatal error: 'allegro5/allegro.h' file not found
#include <allegro5/allegro.h>
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.
gmake[2]: *** [CMakeFiles/pp.dir/build.make:76: CMakeFiles/pp.dir/src/main.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/pp.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2

On macOS 11.4 (20F71) with Apple clang version 12.0.5 (clang-1205.0.22.11)

@SamuelMarks For those demos, you also need to install the extra dependencies such as allegro5, find and use them in your CMakeLists.

I have a bunch of issues about allegro5 installing. For one, there’s no help message after vcpkg install. Secondly, should it not be a FEATURE of nuklear?

@SamuelMarks No, since they are demo codes, nuklear core does not rely on them, so the feature demo only provides installation of these codes instead of guaranteeing that they can run successfully without adding custom codes.

@JackBoosY How do you suggest I test nuklear? — I’m always including the full workflow to recreate my build. — So just tell me what to change.

@SamuelMarks
In CMakeLists.txt:

find_package(unofficial-nuklear CONFIG REQUIRED)

include(FindPackageHandleStandardArgs)
include(SelectLibraryConfigurations)
find_path(ALLEGRO_INCLUDES NAMES allegro.h PATH_SUFFIXES allegro5)
get_filename_component(ALLEGRO_INCLUDES "${ALLEGRO_INCLUDES}" PATH)
find_library(ALLEGRO_LIBRARY_RELEASE NAMES allegro PATH_SUFFIXES lib REQUIRED)
find_library(ALLEGRO_LIBRARY_DEBUG NAMES allegro-debug PATH_SUFFIXES lib REQUIRED)
select_library_configurations(ALLEGRO)

target_compile_definitions(main PRIVATE NK_ALLEGRO5_IMPLEMENTATION)
target_link_libraries(main PRIVATE nuklear ${ALLEGRO_LIBRARIES})
target_include_directories(main PUBLIC ${ALLEGRO_INCLUDES})

Also, you need to copy the related .c file from the share/demo/demo folder.
Sadly, some syntax is not allowed in Visual Studio.

After a ./vcpkg install nuklear allegro5 and removing + recreating the build dir cmake .. gave me:

CMake Error at CMakeLists.txt:16 (find_library):
  Could not find ALLEGRO_LIBRARY_DEBUG using the following names:
  allegro-debug

PS: Your allegro dance… not sure if this is assumed knowledge for everyone using vcpkg?

@vicroms / @JackBoosY I see you’ve closed this issue and merged it in. Do you have a working example CMakeLists.txt + main.c for me to work with on macOS et al.?

Can you please provide the files in VCPKG_ROOT/packages/allegro5_TRIPLET/lib and VCPKG_ROOT/packages/allegro5_TRIPLET/debug/lib ?

@SamuelMarks

Sorry for closing the issue prematurely. GitHub automatically closes issues when a related PR is merged.

The remaining issue here is that Allegro needs to be linked manually, not all libraries offer easy CMake integration (find_package(<pkg name>)) and is mostly responsibility of the upstream library authors to add it.

In some cases, a contributor will add an unofficial target (like Jack did for nuklear) to make it easier to link the libraries. This unofficial targets are «vcpkg specific» so we don’t add them often and any user that makes use of them should know that these are not officially supported by upstream and can be deprecated if the library authors ever add official ones.

For your issue at hand, I think you need to take a look at the contents of {vcpkg root}/installed/{triplet}/debug/lib and check that allegro-debug exists and if it doesn’t replace it with the correct library name. We have a small section on our documentation on how to link libraries that do not have CMake integration. But @JackBoosY’s instructions are more correct and up-to-date with modern CMake best practices.

vcpkg

@ 261c458:

$ ./bootstrap-vcpkg.sh
$ ./vcpkg install nuklear allegro

CMakeList.txt

cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0048 NEW)
project(pp VERSION 0.0.0 LANGUAGES C)

set(src "src/main.c")
set(header "src/nuklear_allegro5.h")

file(DOWNLOAD "https://raw.githubusercontent.com/Immediate-Mode-UI/Nuklear/264abf4/demo/allegro5/nuklear_allegro5.h"
              "${header}"
     EXPECTED_HASH SHA256=7062f21f267ab2e87559c78b4041a6a6afd1a4658e025f1888538e543596f862)
file(DOWNLOAD "https://raw.githubusercontent.com/Immediate-Mode-UI/Nuklear/264abf4/demo/allegro5/main.c"
              "${src}"
     EXPECTED_HASH SHA256=35dcc253847410ad2e9091533ff6d713ee598dc49261a9db2bbaccb747b0a46e)

find_package(unofficial-nuklear CONFIG REQUIRED)

include(FindPackageHandleStandardArgs)
include(SelectLibraryConfigurations)
find_path(ALLEGRO_INCLUDES NAMES allegro.h PATH_SUFFIXES allegro5)
get_filename_component(ALLEGRO_INCLUDES "${ALLEGRO_INCLUDES}" PATH)
find_library(ALLEGRO_LIBRARY_RELEASE NAMES allegro PATH_SUFFIXES lib REQUIRED)
find_library(ALLEGRO_LIBRARY_DEBUG NAMES allegro-debug PATH_SUFFIXES lib REQUIRED)
select_library_configurations(ALLEGRO)

add_executable("${PROJECT_NAME}" "${header}" "${src}")

target_compile_definitions("${PROJECT_NAME}" PRIVATE NK_ALLEGRO5_IMPLEMENTATION)
target_link_libraries("${PROJECT_NAME}" PRIVATE nuklear "${ALLEGRO_LIBRARIES}")
target_include_directories("${PROJECT_NAME}" PUBLIC "${ALLEGRO_INCLUDES}")

build

Then in an empty build directory, one level below that CMakeLists.txt:

$ cmake .. -DCMAKE_BUILD_TYPE='Debug' -DCMAKE_TOOLCHAIN_FILE='[path]/vcpkg/scripts/buildsystems/vcpkg.cmake'
-- The C compiler identification is AppleClang 12.0.5.12050022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:20 (find_library):
  Could not find ALLEGRO_LIBRARY_DEBUG using the following names:
  allegro-debug


-- Configuring incomplete, errors occurred!
See also "build/CMakeFiles/CMakeOutput.log".
See also "build/CMakeFiles/CMakeError.log".

vcpkg dir debugging

@JackBoosY

$ ls installed
vcpkg  x64-osx
$ find installed/vcpkg -type f -name 'allegro*'
installed/vcpkg/info/allegro5_5.2.6.0_x64-osx.list
$ find installed/x64-osx -type f -name 'allegro*'
installed/vcpkg/info/allegro5_5.2.6.0_x64-osx.list
installed/x64-osx/include/allegro5/allegro_acodec.h
installed/x64-osx/include/allegro5/allegro_memfile.h
installed/x64-osx/include/allegro5/allegro_native_dialog.h
installed/x64-osx/include/allegro5/allegro_osx.h
installed/x64-osx/include/allegro5/allegro5.h
installed/x64-osx/include/allegro5/allegro.h
installed/x64-osx/include/allegro5/allegro_audio.h
installed/x64-osx/include/allegro5/allegro_color.h
installed/x64-osx/include/allegro5/allegro_direct3d.h
installed/x64-osx/include/allegro5/platform/allegro_sdl_config.h
installed/x64-osx/include/allegro5/allegro_font.h
installed/x64-osx/include/allegro5/allegro_opengl.h
installed/x64-osx/include/allegro5/allegro_image.h
installed/x64-osx/include/allegro5/allegro_physfs.h
installed/x64-osx/include/allegro5/allegro_primitives.h
installed/x64-osx/include/allegro5/allegro_video.h
installed/x64-osx/lib/pkgconfig/allegro_dialog-static-5.pc
installed/x64-osx/lib/pkgconfig/allegro_image-static-5.pc
installed/x64-osx/lib/pkgconfig/allegro_main-static-5.pc
installed/x64-osx/lib/pkgconfig/allegro_memfile-static-5.pc
installed/x64-osx/lib/pkgconfig/allegro_font-static-5.pc
installed/x64-osx/lib/pkgconfig/allegro-static-5.pc
installed/x64-osx/lib/pkgconfig/allegro_primitives-static-5.pc
installed/x64-osx/lib/pkgconfig/allegro_audio-static-5.pc
installed/x64-osx/lib/pkgconfig/allegro_physfs-static-5.pc
installed/x64-osx/lib/pkgconfig/allegro_color-static-5.pc
installed/x64-osx/lib/pkgconfig/allegro_acodec-static-5.pc
installed/x64-osx/lib/pkgconfig/allegro_video-static-5.pc
installed/x64-osx/debug/lib/pkgconfig/allegro_dialog-debug-static-5.pc
installed/x64-osx/debug/lib/pkgconfig/allegro_image-debug-static-5.pc
installed/x64-osx/debug/lib/pkgconfig/allegro_color-debug-static-5.pc
installed/x64-osx/debug/lib/pkgconfig/allegro_video-debug-static-5.pc
installed/x64-osx/debug/lib/pkgconfig/allegro_main-debug-static-5.pc
installed/x64-osx/debug/lib/pkgconfig/allegro_audio-debug-static-5.pc
installed/x64-osx/debug/lib/pkgconfig/allegro_memfile-debug-static-5.pc
installed/x64-osx/debug/lib/pkgconfig/allegro-debug-static-5.pc
installed/x64-osx/debug/lib/pkgconfig/allegro_physfs-debug-static-5.pc
installed/x64-osx/debug/lib/pkgconfig/allegro_acodec-debug-static-5.pc
installed/x64-osx/debug/lib/pkgconfig/allegro_font-debug-static-5.pc
installed/x64-osx/debug/lib/pkgconfig/allegro_primitives-debug-static-5.pc

Delete @sfhacker comment since this is of no use to deal with this issue.

Use the following cmake instead:

cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0048 NEW)
project(pp VERSION 0.0.0 LANGUAGES C)

set(src "src/main.c")
set(header "src/nuklear_allegro5.h")

file(DOWNLOAD "https://raw.githubusercontent.com/Immediate-Mode-UI/Nuklear/264abf4/demo/allegro5/nuklear_allegro5.h"
              "${header}"
     EXPECTED_HASH SHA256=7062f21f267ab2e87559c78b4041a6a6afd1a4658e025f1888538e543596f862)
file(DOWNLOAD "https://raw.githubusercontent.com/Immediate-Mode-UI/Nuklear/264abf4/demo/allegro5/main.c"
              "${src}"
     EXPECTED_HASH SHA256=35dcc253847410ad2e9091533ff6d713ee598dc49261a9db2bbaccb747b0a46e)

file(DOWNLOAD "https://raw.githubusercontent.com/Immediate-Mode-UI/Nuklear/264abf4/demo/overview.c"
              "overview.c"
     EXPECTED_HASH SHA256=9390689165a3f3ab93a79110172131627bde4ded6251392c467f1d1a51e428df)


find_package(unofficial-nuklear CONFIG REQUIRED)

include(FindPackageHandleStandardArgs)
include(SelectLibraryConfigurations)
find_path(ALLEGRO_INCLUDES NAMES allegro.h PATH_SUFFIXES allegro5)
get_filename_component(ALLEGRO_INCLUDES "${ALLEGRO_INCLUDES}" PATH)
find_library(ALLEGRO_LIBRARY_RELEASE NAMES allegro allegro-static PATH_SUFFIXES lib REQUIRED)
find_library(ALLEGRO_LIBRARY_DEBUG NAMES allegro-debug allegro-debug-static PATH_SUFFIXES lib REQUIRED)
select_library_configurations(ALLEGRO)

find_library(ALLEGRO_IMAGE_LIBRARY_RELEASE NAMES allegro_image allegro_image-static PATH_SUFFIXES lib REQUIRED)
find_library(ALLEGRO_IMAGE_LIBRARY_DEBUG NAMES allegro_image-debug allegro_image-debug-static PATH_SUFFIXES lib REQUIRED)
select_library_configurations(ALLEGRO_IMAGE)

find_library(ALLEGRO_PRIMITIVES_LIBRARY_RELEASE NAMES allegro_primitives allegro_primitives-static PATH_SUFFIXES lib REQUIRED)
find_library(ALLEGRO_PRIMITIVES_LIBRARY_DEBUG NAMES allegro_primitives-debug allegro_primitives-debug-static PATH_SUFFIXES lib REQUIRED)
select_library_configurations(ALLEGRO_PRIMITIVES)

find_library(ALLEGRO_FONT_LIBRARY_RELEASE NAMES allegro_font allegro_font-static PATH_SUFFIXES lib REQUIRED)
find_library(ALLEGRO_FONT_LIBRARY_DEBUG NAMES allegro_font-debug allegro_font-debug-static PATH_SUFFIXES lib REQUIRED)
select_library_configurations(ALLEGRO_FONT)

find_library(ALLEGRO_TTF_LIBRARY_RELEASE NAMES allegro_ttf allegro_ttf-static PATH_SUFFIXES lib REQUIRED)
find_library(ALLEGRO_TTF_LIBRARY_DEBUG NAMES allegro_ttf-debug allegro_ttf-debug-static PATH_SUFFIXES lib REQUIRED)
select_library_configurations(ALLEGRO_TTF)

find_package(freetype CONFIG REQUIRED)
find_package(WebP CONFIG REQUIRED)

add_executable("${PROJECT_NAME}" "${header}" "${src}")

target_compile_definitions("${PROJECT_NAME}" PRIVATE NK_ALLEGRO5_IMPLEMENTATION)
target_link_libraries("${PROJECT_NAME}" PRIVATE
    nuklear
    ${ALLEGRO_LIBRARIES} ${ALLEGRO_IMAGE_LIBRARIES} ${ALLEGRO_PRIMITIVES_LIBRARIES} ${ALLEGRO_FONT_LIBRARIES} ${ALLEGRO_TTF_LIBRARIES}
    GL X11 Xss Xi Xrandr Xxf86vm Xinerama Xcursor Xpm
    m pthread
    freetype
    WebP::webp WebP::webpdemux WebP::libwebpmux WebP::webpdecoder
    jpeg
)
target_include_directories("${PROJECT_NAME}" PUBLIC "${ALLEGRO_INCLUDES}" "${OPENGL_INCLUDE_DIR}")

Change main.c:
#include "../../nuklear.h" to #include "nuklear.h".

Result:

-- The C compiler identification is GNU 7.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found ZLIB: /home/work/vcpkg/installed/x64-linux/debug/lib/libz.a (found version "1.2.11")
-- Found BZip2: /home/work/vcpkg/installed/x64-linux/lib/libbz2.a (found version "1.0.8")
-- Looking for BZ2_bzCompressInit
-- Looking for BZ2_bzCompressInit - found
-- Found PNG: /home/work/vcpkg/installed/x64-linux/debug/lib/libpng.a (found version "1.6.37")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/work/test
[ 50%] Building C object CMakeFiles/pp.dir/src/main.c.o
/home/work/test/src/main.c:21:0: warning: "NK_IMPLEMENTATION" redefined
 #define NK_IMPLEMENTATION

<command-line>:0:0: note: this is the location of the previous definition
/home/work/test/src/main.c:22:0: warning: "NK_ALLEGRO5_IMPLEMENTATION" redefined
 #define NK_ALLEGRO5_IMPLEMENTATION

<command-line>:0:0: note: this is the location of the previous definition
[100%] Linking C executable pp
[100%] Built target pp

freetype has a port bug in its cmake wrapper, will fix later.

@ 57bd710:

$ git clone https://github.com/microsoft/vcpkg && cd vcpkg
$ ./bootstrap-vcpkg.sh
$ ./vcpkg install nuklear allegro
Computing installation plan...
Error: while loading allegro:
The port directory (vcpkg/ports/allegro) does not exist
Error: failed to load port from vcpkg/ports/allegro
Note: Updating vcpkg by rerunning bootstrap-vcpkg may resolve this failure.

I’ll debug tomorrow getting some weirdness… I’m probably on the wrong vcpkg fork/branch or something


But I’ve got to say your CMakeList.txt file is pretty huge to get a working nuklear example. I think #17108 need to be addressed (and maybe a contrib to allegro wouldn’t go amiss…)

& thanks

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#include <stdio.h>
#include <malloc.h>
 
#define myt int
 
// jghtltkbyt nbgjd
typedef struct Line { // jlyjvthysq vfccbd
    int SIZE; // hfpvthb
    int *l;
};
typedef struct Matrix{
    int lines;
    Line *a;
};
 
// prototypes of func
void GetMatrix(Matrix *); // sozdanie matrizu
void OutMatrix(Matrix);
int Nolvch(int *);
int Summ(Matrix *);
void Vector(Matrix *,Line *);
 
int main()
{
    Matrix matr = { 0, NULL };
    Line b = { 0, NULL };
    int c;
    do{
        Matrix m;
        GetMatrix(&m);
        OutMatrix(m);
        Vector(&matr, &b);
        
        scanf_s("%d", &c);
    } while (c != 0);
    return 0;
}
 
void GetMatrix(Matrix * x)
{
    printf("vvedi kolvo strock: ");
    scanf_s("%d", &x->lines, sizeof(int));
    x->a = (Line *)malloc(x->lines * sizeof(Line));
    
    for (int i = 0; i < x->lines; ++i)
    {
        printf("Sizeof(m[%i]) = ", i);
        scanf_s("%i", &x->a[i].SIZE, sizeof(x->a[i].SIZE));
        x->a[i].l = (int *)malloc(x->a[i].SIZE*sizeof(int));
        
        for (int j = 0; j < x->a[i].SIZE; j++)
        {
            printf("tm[%d,%d] = ", i,j);
            scanf_s("%i", &x->a[i].l[j], sizeof(int));
        }
    }
}
 
int Nolvch(int a)
{
    int i = 0;
    int n = 0;
    while (a > 0)
    {
        n = a % 10;
        if (n = 0)
        {
            return 1;
        }
        a = a / 10;
    }
    
    return 0;
}
 
int Summ(Line *a)
{
    int *summ;
    
    for (int j = 0; j <a->SIZE; j++)
    {
        
        if (Nolvch(a->l[j]) == 0)
            *summ += a->l[j];
    }
    return *summ;
    
}
 
void vector(Matrix *matr, Line *b)
{
    int i, j, n, m, c, flag, s;
    Line PLINE;
    int *pElem;
    n = matr->lines;
    PLINE= matr->lines;
    n = matr->n;
    b->m = n;
    b->line = (int *)calloc(n, sizeof(int));
    for (i = 0; i < n; i++){
        s = 0;
        m = pLine->m;
        pElem = pLine->line;
        for (j = 0; j < m; j++){
            c = *pElem;
            flag = 1;
            while ((c > 0) && (flag == 1)){
                if (c % 10 == 0) flag = 0;
                c /= 10;
            };
            if (flag) s += *pElem;
            pElem++;
        }
        b->line[i] = s;
        pLine++;
    }
    output_v(b);
}
 
 
void OutMatrix(Matrix x)
{
    printf("matriza : n");
    for (int i = 0; i < x.lines; i++) 
    {
        for (int j = 0; j < x.a[i].SIZE; j++)
        {
            printf("%i%s", x.a[i].l[j]," ");
        }
        printf("n");
    }
}

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Fatal error loading vertex shader custom weapon vs30 00000000 что делать
  • Fatal error loading vertex shader custom weapon vs30 00000000 cs go как исправить
  • Fatal error loading unverified resource doom
  • Fatal error loading the db invalid argument exiting
  • Fatal error loading pixel shader custom weapon ps30

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии