Awesome trick - no worrying to " and \n" in C++

Posted 1 month ago2022-04-07 05:31:11 UTC
DeafMan1983 DeafMan1983C# Developer and Linux Creator
Hello everyone and my valuable friends,

I wanna to show how do you write shader without annoying like
" ... \n"
Then you should define simple for GLSL for example:
#define GLSL(version, shader)  "#version " #version "\n" #shader
Then you would like know to write if gcc or cl won't throw error lines. :)
For example with shader sources under cpp file:
User posted image
I hope I can help everyone and happy coding!

2 Comments

Commented 1 month ago2022-04-07 11:05:00 UTC Comment #104319
You can also use raw string literals which support multiline strings: https://en.cppreference.com/w/cpp/language/string_literal
Commented 1 month ago2022-04-07 11:46:12 UTC Comment #104320
@Solo thank you for link!

You must log in to post a comment. You can login or register a new account.