I was trying to compile a c project in visual studio which generated by ECPG file then I got this error
LNK1104 cannot open file 'C:Program FilesPostgreSQL14lib.obj
even though I added this line C:Program FilesPostgreSQL14lib
in Additional Dependencies in addtion to this line C:Program FilesPostgreSQL14include
in Additional Include Directories
I tried to open Additional Dependencies to change
C:Program FilesPostgreSQL14lib
To
"C:Program FilesPostgreSQL14lib"
but still the same error
2
Answers
this is not the correct way to link a library in VScode
go to Project
Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies.
and add the name of the library you want to linkfinally, make sure that you are configuring it in the correct platform (x86 or x64)
The Visual Studio linker is unable to locate the required PostgreSQL library files, which results in the error "LNK1104 cannot open file ‘C:Program FilesPostgreSQL14lib.obj".
Verify the Visual Studio settings are right, double-check the path to the ‘lib’ directory, and look for security involvement or problems with file permissions.
Consider using environment variables as well to indicate the proper locations.