Rust Weird error cant fix it

Ok so I have a windows 10 pc and I get a weird error

error: failed to run custom build command for `raylib-sys v3.7.0`

Caused by:
  process didn't exit successfully: `C:\Users\Shadow\Desktop\test\rust-thing\target\debug\build\raylib-sys-5b3c7a5f5ef882b6\build-script-build` (exit code: 101)     
  --- stdout
  CMAKE_TOOLCHAIN_FILE_x86_64-pc-windows-msvc = None
  CMAKE_TOOLCHAIN_FILE_x86_64_pc_windows_msvc = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-pc-windows-msvc = None
  CMAKE_GENERATOR_x86_64_pc_windows_msvc = None
  HOST_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-pc-windows-msvc = None
  CMAKE_PREFIX_PATH_x86_64_pc_windows_msvc = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-pc-windows-msvc = None
  CMAKE_x86_64_pc_windows_msvc = None
  HOST_CMAKE = None
  CMAKE = None
  running: "cmake" "C:\\Users\\Shadow\\Desktop\\test\\rust-thing\\target\\debug\\build\\raylib-sys-33174730eff2a78d\\out\\raylib" "-G" "Visual Studio 17 2022" "-Thost=x64" "-Ax64" "-DBUILD_EXAMPLES=OFF" "-DCMAKE_BUILD_TYPE=Release" "-DSUPPORT_BUSY_WAIT_LOOP=OFF" "-DPLATFORM=Desktop" "-DCMAKE_INSTALL_PREFIX=C:\\Users\\Shadow\\Desktop\\test\\rust-thing\\target\\debug\\build\\raylib-sys-33174730eff2a78d\\out" "-DCMAKE_C_FLAGS= -nologo -MD -Brepro" "-DCMAKE_C_FLAGS_RELEASE= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS_RELEASE= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS_RELEASE= -nologo -MD -Brepro"
  -- Configuring incomplete, errors occurred!
  See also "C:/Users/Shadow/Desktop/test/rust-thing/target/debug/build/raylib-sys-33174730eff2a78d/out/build/CMakeFiles/CMakeOutput.log".

  --- stderr
  CMake Error at CMakeLists.txt:2 (project):
    Generator

      Visual Studio 17 2022

    could not find any instance of Visual Studio.



  thread 'main' panicked at '
  command did not execute successfully, got: exit code: 1

  build script failed, must exit now', C:\Users\Shadow\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.48\src\lib.rs:975:5
  stack backtrace:
     0:     0x7ff6a8f783ff - std::backtrace_rs::backtrace::dbghelp::trace
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
     1:     0x7ff6a8f783ff - std::backtrace_rs::backtrace::trace_unsynchronized
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
     2:     0x7ff6a8f783ff - std::sys_common::backtrace::_print_fmt
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\sys_common\backtrace.rs:66
     3:     0x7ff6a8f783ff - std::sys_common::backtrace::_print::impl$0::fmt
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\sys_common\backtrace.rs:45
     4:     0x7ff6a8f9594a - core::fmt::write
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\core\src\fmt\mod.rs:1198
     5:     0x7ff6a8f721a9 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\io\mod.rs:1672
     6:     0x7ff6a8f7b0bb - std::sys_common::backtrace::_print
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\sys_common\backtrace.rs:48
     7:     0x7ff6a8f7b0bb - std::sys_common::backtrace::print
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\sys_common\backtrace.rs:35
     8:     0x7ff6a8f7b0bb - std::panicking::default_hook::closure$1
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\panicking.rs:295
     9:     0x7ff6a8f7ad35 - std::panicking::default_hook
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\panicking.rs:314
    10:     0x7ff6a8f7b669 - std::panicking::rust_panic_with_hook
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\panicking.rs:698
    11:     0x7ff6a8f7b56d - std::panicking::begin_panic_handler::closure$0
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\panicking.rs:588
    12:     0x7ff6a8f79037 - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\sys_common\backtrace.rs:138
    13:     0x7ff6a8f7b249 - std::panicking::begin_panic_handler
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\panicking.rs:584
    14:     0x7ff6a8f9c675 - core::panicking::panic_fmt
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\core\src\panicking.rs:142
    15:     0x7ff6a8ec9742 - cmake::fail
                                 at C:\Users\Shadow\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.48\src\lib.rs:975
    16:     0x7ff6a8ec90cc - cmake::run
                                 at C:\Users\Shadow\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.48\src\lib.rs:953
    17:     0x7ff6a8ec5872 - cmake::Config::build
                                 at C:\Users\Shadow\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.48\src\lib.rs:780
    18:     0x7ff6a8eb46b8 - build_script_build::build_with_cmake
                                 at C:\Users\Shadow\.cargo\registry\src\github.com-1ecc6299db9ec823\raylib-sys-3.7.0\build.rs:71
    19:     0x7ff6a8eb5a47 - build_script_build::main
                                 at C:\Users\Shadow\.cargo\registry\src\github.com-1ecc6299db9ec823\raylib-sys-3.7.0\build.rs:202
    20:     0x7ff6a8eb6f8b - core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52\library\core\src\ops\function.rs:248
    21:     0x7ff6a8eb6f2b - std::sys_common::backtrace::__rust_begin_short_backtrace<void (*)(),tuple$<> >
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52\library\std\src\sys_common\backtrace.rs:122
    22:     0x7ff6a8ebb1a1 - std::rt::lang_start::closure$0<tuple$<> >
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52\library\std\src\rt.rs:145
    23:     0x7ff6a8f6c57b - core::ops::function::impls::impl$2::call_once
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\core\src\ops\function.rs:280
    24:     0x7ff6a8f6c57b - std::panicking::try::do_call
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\panicking.rs:492
    25:     0x7ff6a8f6c57b - std::panicking::try
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\panicking.rs:456
    26:     0x7ff6a8f6c57b - std::panic::catch_unwind
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\panic.rs:137
    27:     0x7ff6a8f6c57b - std::rt::lang_start_internal::closure$2
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\rt.rs:128
    28:     0x7ff6a8f6c57b - std::panicking::try::do_call
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\panicking.rs:492
    29:     0x7ff6a8f6c57b - std::panicking::try
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\panicking.rs:456
    30:     0x7ff6a8f6c57b - std::panic::catch_unwind
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\panic.rs:137
    31:     0x7ff6a8f6c57b - std::rt::lang_start_internal
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\rt.rs:128
    32:     0x7ff6a8ebb16f - std::rt::lang_start<tuple$<> >
                                 at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52\library\std\src\rt.rs:144
    33:     0x7ff6a8eb67a6 - main
    34:     0x7ff6a8f9ae00 - invoke_main
                                 at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
    35:     0x7ff6a8f9ae00 - __scrt_common_main_seh
                                 at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    36:     0x7ff91b0b7034 - BaseThreadInitThunk

and the code is

use raylib::prelude::*;

fn main() {
    let (mut rl, thread) = raylib::init()
        .size(640, 480)
        .title("Hello, World")
        .build();

    while !rl.window_should_close() {
        let mut d = rl.begin_drawing(&thread);

        d.clear_background(Color::WHITE);
        d.draw_text("Hello, world!", 12, 12, 20, Color::BLACK);
    }
}

can anyone fix sorry i posted wrong

The raylib crate needs to build the underlying raylib C library. It looks like the build may require Visual Studio specifically rather than just any C compiler. Do you have a version of Visual Studio installed?

Just to add to what @semicoleon writes - if you don't have (or otherwise require) Visual Studio, you don't need the full horror. You can just install the build tools - see 'Build Tools for Visual Studio 2022' here: Download Visual Studio Tools - Install Free for Windows, Mac, Linux. It's still a pretty big download IIRC.

2 Likes