You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to run this code and it crashes with this error: make: *** [Makefile:98: execute] Error 3
I am using raylib-cpp and json by nlohmann.
The nlohmann .hpp file is on include/nlohmann folder.
It crashes on line 11 specifically. I have also tried changing it to settings = nlohmann::json::parse(settings_file)
Reproduction steps
On command prompt make
Expected vs. actual results
Expected:
The app window pop-ups
Actual:
Make crashes
Minimal code example
#include <iostream>#include <fstream>#include <raylib-cpp.hpp>#include "nlohmann/json.hpp"
int main(int argc, const char** argv) {
// Initialization
nlohmann::json settings;
std::ifstream settings_file("settings.json");
settings_file >> settings; // Line 11 - Crashes Here
settings_file.close();
raylib::Window win(800, 600, "Test");
SetTargetFPS(60);
// Main game loop
while (!win.ShouldClose())
{
// Update
// Draw
BeginDrawing();
ClearBackground(RAYWHITE);EndDrawing();
}
return 0;
}
With this make file
# Copyright (c) 2020 Jonathan Moallem (@J-Mo63) & Aryeh Zinn (@Raelr)
#
# This code is released under an unmodified zlib license.
# For conditions of distribution and use, please see:
# https://opensource.org/licenses/Zlib
# Define custom functions
rwildcard = $(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
platformpth = $(subst /,$(PATHSEP),$1)
# Set global macros
buildDir := bin
executable := app
target := $(buildDir)/$(executable)
sources := $(call rwildcard,src/,*.cpp)
objects := $(patsubst src/%, $(buildDir)/%, $(patsubst %.cpp, %.o, $(sources)))
depends := $(patsubst %.o, %.d, $(objects))
compileFlags := -std=c++17 -I include
linkFlags = -L lib/$(platform) -l raylib
# Check for Windows
ifeq ($(OS), Windows_NT)
# Set Windows macros
platform := Windows
CXX ?= g++
linkFlags += -Wl,--allow-multiple-definition -pthread -lopengl32 -lgdi32 -lwinmm -mwindows -static -static-libgcc -static-libstdc++
libGenDir := src
THEN := &&
PATHSEP := \$(BLANK)
MKDIR := -mkdir -p
RM := -del /q
COPY = -robocopy "$(call platformpth,$1)" "$(call platformpth,$2)" $3
else
# Check for MacOS/Linux
UNAMEOS := $(shell uname)
ifeq ($(UNAMEOS), Linux)
# Set Linux macros
platform := Linux
CXX ?= g++
linkFlags += -l GL -l m -l pthread -l dl -l rt -l X11
endif
ifeq ($(UNAMEOS), Darwin)
# Set macOS macros
platform := macOS
CXX ?= clang++
linkFlags += -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL
libGenDir := src
endif
# Set UNIX macros
THEN := ;
PATHSEP := /
MKDIR := mkdir -p
RM := rm -rf
COPY = cp $1$(PATHSEP)$3 $2
endif
# Lists phony targets for Makefile
.PHONY: all setup submodules execute clean
# Default target, compiles, executes and cleans
all: $(target) execute clean
# Sets up the project for compiling, generates includes and libs
setup: include lib
# Pull and update the the build submodules
submodules:
git submodule update --init --recursive
# Copy the relevant header files into includes
include: submodules
$(MKDIR) $(call platformpth, ./include)
$(call COPY,vendor/raylib-cpp/vendor/raylib/src,./include,raylib.h)
$(call COPY,vendor/raylib-cpp/vendor/raylib/src,./include,raymath.h)
$(call COPY,vendor/raylib-cpp/include,./include,*.hpp)
# Build the raylib static library file and copy it into lib
lib: submodules
cd vendor/raylib-cpp/vendor/raylib/src $(THEN) "$(MAKE)" PLATFORM=PLATFORM_DESKTOP
$(MKDIR) $(call platformpth, lib/$(platform))
$(call COPY,vendor/raylib-cpp/vendor/raylib/$(libGenDir),lib/$(platform),libraylib.a)
# Link the program and create the executable
$(target): $(objects)
$(CXX) $(objects) -o $(target) $(linkFlags)
# Add all rules from dependency files
-include $(depends)
# Compile objects to the build directory
$(buildDir)/%.o: src/%.cpp Makefile
$(MKDIR) $(call platformpth, $(@D))
$(CXX) -MMD -MP -c $(compileFlags) $< -o $@ $(CXXFLAGS)
# Run the executable
execute:
$(target) $(ARGS)
# Clean up all relevant files
clean:
$(RM) $(call platformpth, $(buildDir)/*)
What does "crash" mean? A signal? An exception? Can you run in a debugger and provide a stacktrace? Can you make sure file settings.json is in the work directory, is readable by the process and is valid JSON?
Description
I am trying to run this code and it crashes with this error:
make: *** [Makefile:98: execute] Error 3
I am using
raylib-cpp
andjson
by nlohmann.The nlohmann .hpp file is on include/nlohmann folder.
It crashes on line 11 specifically. I have also tried changing it to
settings = nlohmann::json::parse(settings_file)
Reproduction steps
On command prompt
make
Expected vs. actual results
Expected:
The app window pop-ups
Actual:
Make crashes
Minimal code example
With this make file
Compiler and operating system
G++ Windows
Library version
3.10.5
Validation
develop
branch is used.The text was updated successfully, but these errors were encountered: