0

I'm trying to make a quick c++ compiler in batch, but it keeps on giving me 2 errors.

The filename, directory name, or volume label syntax is incorrect.

g++: error: missing filename after '-o'

I don't know where these errors are coming from since I double checked my path that I was inputting , and it worked fine on normal command line, and I have a var after the -o that acts as a filename. I was wondering if anyone could help me figure this out.

Here is my Code

@echo off
set /p path = "Path of Program "
set /p file = "filename "
set /p exe = " exe name "
cd \
cd %path%
g++ %file% -IC:\Development\i686-w64-mingw32\include -L C:\Development\i686-w64-mingw32\lib -w -Wl,-subsystem,windows -lmingw32 -lSDL2main -lSDL2 -o %exe%
pause
Acohen
  • 36
  • 6
  • 3
    You can't put a space between the variable name and the equals symbol with the `SET` command. Remove the space. – Squashman Mar 15 '18 at 23:09
  • 4
    I would also highly advise you not overwrite the system variable `PATH`. Make a different variable name for path like `ppath`. – Squashman Mar 15 '18 at 23:12
  • what about the g++ error missing filename after -o? – Acohen Mar 16 '18 at 03:10
  • 1
    I know nothing about `g++`. I do know the proper syntax for `batch-files`. I assumed that fixing the `SET` commands would have fixed all your errors. – Squashman Mar 16 '18 at 03:27

0 Answers0