will not work when called in a C++ program, while it works perfectly in a bat file? Even making a bat file and trying to call it in C++ does not work.
BTW, I know the proper way to compile a GLSL file for Vulkan in C++ is to use glslang directly or a library like shaderc, this is not a Vulkan question.
what does it do or say?
why does it have () around it? (this may not be wrong, but its a little odd).
does this program need some environment path or something that is not present when you run a program, but is fine in a console?
Just a thought here, but it has been my experience that in using "system" that it is written as system(""); with what you need between the quotes.
I did have one situation where I created a "std::string" and the "system" call is: systen(str.c_str()); and it worked. The string starts with "Foo.bat" then a space and the rest of the string is inside quotes that have been escaped. Putting the rest of the string in quotes is to deal with directories and filenames that may contain a space.
You might try this: system("R\"(C:/VulkanSDK/Bin32/glslangValidator.exe -V G:/shaders/vertex.vert)\"");. The underlined quotes and the \ is added. Give this a try and see if that works.
why does it have () around it? (this may not be wrong, but its a little odd).
Look up C++ raw strings. It can be even odder since you can put extra stuff between the opening " and ( that serves as a delimiter (and it also must be between the closing ) and ").
std::system(R"jonin(ls -l)jonin");
But a raw string is not needed in the OP's example since he's used forward slashes. Usually you might use it to avoid needing to use double backslashes for every backslash.
Although you can use forward slashes when opening a file in C++ even for Windows, you probably need to use backslashes when sending a string to the Windows console, which is presumably why you are using a raw string in the first place.
EDIT: I just saw your response. I guess you can use forward slashes in the console, too. Interesting.