DevIL を使用して C++ OpenGL プロジェクトを作成していますが、テクスチャとして使用するイメージをロードする方法を見つけようとしているときにコンパイル エラーが発生します。
これまでのところ、私はこれを持っています
//Declarations
const char* filename = "back.bmp";
ILboolean ilLoadImage(const char *filename);
ILuint image;
ilGenImages(1, &image);
ilBindImage(image);
//Load the image
if (!ilLoadImage(filename))
{
throw runtime_error("Unable to load image" +filename);
}
エラーが表示されます:error C2110: '+' : cannot add two pointers
filename
toの宣言string filename = "back.bmp";
と if 文を toに変更すると
if (!ilLoadImage(const_cast<char*>(filename.c_str())))
このリンカーエラーが発生しますerror LNK1104: cannot open file 'DevIL.libkernel32.lib'
すべての DevIL ファイルを必要な場所に配置し、依存関係を Project->Properties->Linker->Input->Additional Dependencies に追加したことは確かです。