1

Possible Duplicate:
C/C++, can you #include a file into a string literal?

I have several data files that will be used as a strings in my program. I want to avoid the extra overhead of reading in the files at runtime.

I could hard code them all in but I much prefer to keep them in separate files.

I could included them but then I would need to enclose them with quotation marks and add "\" for every new line (and since this data is GLSL source it messes up the syntax highlighting).

Any Ideas?

Community
  • 1
  • 1
null_radix
  • 692
  • 2
  • 6
  • 19

1 Answers1

3

Make a script to convert the files into code. Have this script executed as part of your build process. The original files are what you check into source control and edit.

Laurence Gonsalves
  • 137,896
  • 35
  • 246
  • 299
  • There is no way to pre-compile GLSL shaders simply because there is no common micro-architecture dictated by ARB and hence each vendor has his own micro-codes. – null_radix Nov 28 '10 at 06:46
  • 1
    @null_radix a script that converts them to C code that "encapsulates" original files. It's an automatization of your idea with includes, but it would preserve the original files unmodified. It's called "source code generation". – ruslik Nov 28 '10 at 06:52