You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To this: std::string err; if (!tinyobj::LoadObj(&attrib, &shapes, &materials, &err, MODEL_PATH.c_str())) { throw std::runtime_error(err); }
I humbly suggest making these changes to the code given in https://vulkan-tutorial.com/Loading_models; hopefully no one else has to go through the process of figuring this out like I did o_o'. Thanks for reading this nonetheless.
The text was updated successfully, but these errors were encountered:
Daxturus
changed the title
In the "Loading Models" chapter, tinyobj::loadObj(...) recieves invalid arguments, preventing compilation
In the "Loading Models" chapter, tinyobj::loadObj(...) recieves invalid arguments, causes compilation to fail
Apr 24, 2025
Daxturus
changed the title
In the "Loading Models" chapter, tinyobj::loadObj(...) recieves invalid arguments, causes compilation to fail
In the "Loading Models" chapter, tinyobj::loadObj(...) recieves invalid arguments, causing compilation to fail
Apr 25, 2025
Earlier I raised issue #403, after I was unable to compile the source code give in the "Loading Models" section.
In the base code, two empty strings, &warn and &err, are passed to tinyobj::loadObj().
tinyobj::LoadObj(&attrib, &shapes, &materials, &warn, &err, MODEL_PATH.c_str())
However, currently, TinyObjLoader v1.0.6 does not have a function that accepts two strings for error handling. The closest match is this:
bool LoadObj(attrib_t *attrib, std::vector<shape_t> *shapes, std::vector<material_t> *materials, std::string *err, const char *filename, const char *mtl_basedir, bool trianglulate)
...which only has one input string for error handling.
Because the given example code passes both &err and &warn, it fails to compile with a "no matching function" error.
I was able to fix this by changing the code around line 1000... (in https://vulkan-tutorial.com/code/28_model_loading.cpp)
...From this:
std::string warn, err; if (!tinyobj::LoadObj(&attrib, &shapes, &materials, &warn, &err, MODEL_PATH.c_str())) { throw std::runtime_error(warn + err); }
To this:
std::string err; if (!tinyobj::LoadObj(&attrib, &shapes, &materials, &err, MODEL_PATH.c_str())) { throw std::runtime_error(err); }
I humbly suggest making these changes to the code given in https://vulkan-tutorial.com/Loading_models; hopefully no one else has to go through the process of figuring this out like I did o_o'. Thanks for reading this nonetheless.
The text was updated successfully, but these errors were encountered: