1

由于一些有缺陷的第三方库,我的代码只能在调试模式下工作。

由于我使用了相当多的 std::vector,代码在调试模式下相当慢(因为它使用调试 STL),现在有人说改用运行时库。

我将代码生成从 /MDd 交换到 /MD,现在我的代码在一些基本功能上失败了。

例如,我有从这样的文件中提取数据的代码:

    template <class T> void ExtractData(std::string fileName, int& dataSize, std::vector<T>& data) {
    std::ifstream myfile;
    myfile.open(fileName, std::ios_base::binary);

    if (myfile.is_open()) {
        myfile.seekg(0, std::ios::end);
        int size = (int)(myfile.tellg());
        dataSize = size / sizeof(T);
        data.resize(size / sizeof(T));
        myfile.seekg(0, std::ios::beg);
        myfile.read( (char*)&data.at(0), size );
    }

    myfile.close();
}

并且此代码在 myfile.seekg() 上失败,但在 ntdll.dll 中有一些异常

我能做些什么呢?

4

0 回答 0