开发者

How can I include a data file at compile time? [duplicate]

开发者 https://www.devze.com 2023-01-27 11:50 出处:网络
This question already 开发者_开发问答has answers here: Closed 12 years ago. Possible Duplicate: C/C++, can you #include a file into a string literal?
This question already 开发者_开发问答has answers here: Closed 12 years ago.

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消