A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
Hi @Mitta mohith , and thanks for posting your question.
Please first copy the complete LNK1104 line from View > Output > Build, because the two library names have different meanings:
-
msvcprtd.libis a valid Microsoft debug C++ runtime library. -
msvcportlib.libis not a standard MSVC library name and is likely an incorrect dependency.
If the actual error is:
LNK1104: cannot open file 'msvcprtd.lib'
the most likely cause is that the project has replaced Visual Studio’s default library paths while adding the GLFW library directory.
Open Project > Properties, select the failing configuration such as Debug | x64, then check:
VC++ Directories > Library Directories
Open the drop-down and select Inherit from parent or project defaults. Add the GLFW path under Linker > General > Additional Library Directories instead of replacing the default MSVC library directories.
Also confirm that Desktop development with C++, the MSVC toolset, and a Windows SDK are installed in Visual Studio Installer. MSVCPRTD.lib should be supplied and located automatically by the MSVC toolset.
If the error actually says:
LNK1104: cannot open file 'msvcportlib.lib'
check Linker > Input > Additional Dependencies and remove that entry. Also search the project for:
#pragma comment(lib, "msvcportlib.lib")
If the name is not present in the project settings or source code, it may be embedded in a prebuilt library. Check it from a Developer Command Prompt:
dumpbin /directives path\to\glfw3.lib | findstr /i msvcport
If GLFW or another .lib contains /DEFAULTLIB:msvcportlib.lib, rebuild that library with the same Visual Studio toolset and platform as the application.
If the source is still unclear, enable Tools > Options > Projects and Solutions > Build and Run > MSBuild project build output verbosity > Diagnostic, rebuild, and search the Output window for the library name.
Do not download a random copy of the missing .lib. Restore the inherited MSVC paths or remove/rebuild the dependency that requests the incorrect library.
If this instruction is applicable to your situation, I would greatly appreciate it if you could follow the instruction here so others experiencing similar behavior can benefit from it as well.