C2065 для stb_image в исходном файлеC++

Программы на C++. Форум разработчиков
Anonymous
C2065 для stb_image в исходном файле

Сообщение Anonymous »

У меня есть 3 файла: main.cpp, static_mesh.hpp и static_mesh.cpp.
main.cpp включает static_mesh.hpp; static_mesh.hpp включает tiny_gltf.h, который включает stb_image; static_mesh.cpp включает static_mesh.hpp.
main.cpp определяет STB_IMAGE_IMPLEMENTATION и STB_IMAGE_WRITE_IMPLEMENTATION перед включением static_mesh.hpp.
Проблема в том, что я получаю ошибки, потому что компилятор не распознает тип stbi_uc и функцию stbi_load_from_memory() в static_mesh.cpp.
Вот раздел кода для этих файлов:
main.cpp:
...
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION

#define TINYGLTF_IMPLEMENTATION

#include "static_mesh.hpp"
...

static_mesh.hpp:
#pragma once

#include
...

static_mesh.cpp:
#include
...
int x, y;
int channels_in_file;
stbi_uc* data = stbi_load_from_memory(v_ptr, bufferview.byteLength, &x, &y, &channels_in_file, image.component);
...


Подробнее здесь: https://stackoverflow.com/questions/793 ... ource-file

Вернуться в «C++»