Command Line compile on Win32

I have been trying to compile my raylib project using a batch file and it is not working. Here's the setup: I first add
PATH="C:\raylib\MinGW\bin";"C:\raylib\MinGW\libexec\gcc\mingw32\5.3.0";%PATH%
to the path.

Then I try to compile this code:

#include "C:\raylib\raylib\src\raylib.h"

int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;

InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");

SetTargetFPS(60);
//--------------------------------------------------------------------------------------

// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------

// Draw
//----------------------------------------------------------------------------------
BeginDrawing();

ClearBackground(RAYWHITE);

DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);

EndDrawing();
//----------------------------------------------------------------------------------
}

// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------

return 0;
}
from the examples page.
Then I try to compile this code using this batch file:

@echo off

mkdir ..\..\build

pushd ..\..\build

g++ ..\project\code\rayproject.cpp -o rayproject.exe

popd

and I get this error:

g++: error: CreateProcess: No such file or directory

What am I doing wrong here?

Comments

  • You should try the tools provided, the Notepad++ script works great.
  • I don't know have to use Notepad++ and I have my own code editor that I would like to use. There's no reason why I shouldn't be able to compile this program on the command line. I just need someone who knows how to fix this error.
  • To compile raylib program you should use GCC and link with required libraries:

    gcc -o rayproject.exe rayproject.c -s -lraylib -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,-allow-multiple-definition -Wl,--subsystem,windows
Sign In or Register to comment.