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"
...
Код: Выделить всё
#pragma once
#include
...
Код: Выделить всё
#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);
...
Код: Выделить всё
static_mesh.cpp(71,3): error C2065: 'stbi_uc': undeclared identifier
static_mesh.cpp(71,12): error C2065: 'data': undeclared identifier
static_mesh.cpp(71,19): error C3861: 'stbi_load_from_memory': identifier not found
static_mesh.cpp(79,104): error C2065: 'data': undeclared identifier
Подробнее здесь: https://stackoverflow.com/questions/793 ... ource-file
Мобильная версия