0

Just trying to set up a sublime-build for my OpenGL coding on Windows 8.1.

This is what I have:

{
"cmd": [ "gcc -o \"$file\" \"$file_base_name\" -lGLU -lGL -lglut && ./\"$file_base_name\""],
"working_dir": "${project_path:${folder}}",
"selector": ["source.c"],
"shell": true  
}

The error that I'm getting is gcc: error: "tute2": Invalid argument when trying to compile tute2.c.

What am I doing wrong?

An0nx
  • 19
  • 2
  • 9

1 Answers1

0

Please replace

"cmd": [ "gcc -o \"$file\" \"$file_base_name\" -lGLU -lGL -lglut && ./\"$file_base_name\""],

with

"cmd": [ "gcc -o $file_base_name $file -lGLU -lGL -lglut && ./$file_base_name"],

and try again.

Lee Duhem
  • 14,695
  • 3
  • 29
  • 47
  • I get the error: `gcc: error: "G:\Uni\test\tute2.c": Invalid argument` – An0nx Mar 24 '14 at 10:11
  • @An0nx It looks like `"` also become part of the argument, try to remove them, as I did in the updated answer. – Lee Duhem Mar 24 '14 at 10:57
  • Seems to have fixed that problem, now I'm getting `c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lGLU c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lGL c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lglut collect2.exe: error: ld returned 1 exit status` I'm not exactly sure what it's asking because it refers to multiple different folders there. – An0nx Mar 24 '14 at 13:31
  • @An0nx You need to add arguments like `-L/path/to/libGLU` and so on to `gcc`. – Lee Duhem Mar 24 '14 at 13:36
  • how exactly is that done? something like this? `"cmd": [ "gcc -o $file_base_name $file -L/C:/MinGW/lib/glut32.lib -lGLU -lGL -lglut -lglut32win && ./$file_base_name"],` – An0nx Mar 24 '14 at 13:43
  • @An0nx If all those libraries are under the same directory `C:/MinGW/lib/`, then that option should be `-LC:/MinGW/lib/`. Otherwise you need to add those directories one by one. – Lee Duhem Mar 24 '14 at 13:45
  • Is it looking for `glut32.lib` because that is in my `C:/MinGW/lib/` folder and I'm still getting the same error. – An0nx Mar 24 '14 at 15:19
  • @An0nx I am not sure, on Linux with `-lGLU` `ld` will look for `libGLU.so`, others are similar. If your system has those files, you should give them a try. – Lee Duhem Mar 24 '14 at 15:56