Embedding resources in executable using GCC

前端 未结 4 1708
小鲜肉
小鲜肉 2020-11-22 16:21

I\'m looking for a way to easily embed any external binary data in a C/C++ application compiled by GCC.

A good example of what I\'d like to do is handling shader cod

4条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 17:08

    You could do this in a header file :

    #ifndef SHADER_SRC_HPP
    #define SHADER_SRC_HPP
    const char* shader= "
    
    //source
    
    ";
    #endif
    

    and just include that.

    Other way is to read the shader file.

提交回复
热议问题