LNK2019:使用 std::ifstream 时未解析的外部符号

LNK2019: unresolved extrenal symbol when using std::ifstream

我在 C++ 中使用 std::ifstream 时遇到问题。我正在使用 Visual Studio 2019。每次我想初始化 std::ifstream 对象时,它都会给我这些错误:

文件:Shader.obj

LNK2019 unresolved external symbol __imp___invalid_parameter referenced in function "void * __cdecl std::_Allocate_manually_vector_aligned(unsigned int)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPAXI@Z)

LNK2019 unresolved external symbol __imp___CrtDbgReport referenced in function "void * __cdecl std::_Allocate_manually_vector_aligned(unsigned int)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPAXI@Z)

文件:msvcprtd.lib(locale0_implib.obj)

LNK2019 unresolved external symbol __imp___free_dbg referenced in function "public: static void __cdecl std::_Fac_node::operator delete(void *)" (??3_Fac_node@std@@SAXPAX@Z)

LNK2019 unresolved external symbol __imp___malloc_dbg referenced in function "public: static void * __cdecl std::_Fac_node::operator new(unsigned int)" (??2_Fac_node@std@@SAPAXI@Z)

Shader.h

#pragma once

#include <iostream>
#include <fstream>
#include <string>

#include <GLFW/glfw3.h>
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>
#include <glm/mat4x4.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>

class Shader
{
private:
    /* some code */
public:
    /* some code */
    void setSourceFile(const std::string& filename);
}

Shader.cpp

#include "Shader.h"

/* some code */

void Shader::setSourceFile(const std::string& filename)
{
    std::ifstream* shaderFile = new std::ifstream();
}

即使我 运行 只是 std::ifstream shaderFile(); 甚至在将参数传递给构造函数之后,这些错误仍然存​​在。当我对此发表评论时,程序会正确构建。

问题是我链接了一些 realease 库(glew32.libglfw32.lib)与调试库。因此,在 Project Properties->Linker->General 中,我已将 A​​dditional Library Directories 更改为调试库,并在 Linker->输入 更改了文件名。

感谢@drescherjm 和@1201ProgramAlarm 的建议!