Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.3k views
in Technique[技术] by (71.8m points)

c++ - fmt::format access violation

I have no idea what's wrong with this. Recently built a new PC and it worked just fine (same project, same settings in visual studio, etc). But for some reason any time I try fmt::format it will give me an access violation exception. Though if formatting with spdlog for example it works fine.

const char* TextureException::what() const noexcept
{
    mWhat = fmt::format("{}
[Info] {}", getType(), getInfo()); // access violation
    return mWhat.c_str();
}

getType() just returns some identifying information, its hard coded right now so its not a nullptr or anything. Same with getInfo() (except this returns file and line number)

And even just testing some code will give me an access violation error:

int main(int argc, char** argv)
{
    std::string test = fmt::format("Testing {}", 32); // access violation
    std::cout << test << "
";
}

I am completely stumped as to why this is no longer working on the new PC.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...