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 Files\PostgreSQL\14\lib.obj even though I added this line C:\Program Files\PostgreSQL\14\lib in Additional Dependencies in addtion to this line C:\Program Files\PostgreSQL\14\include in Additional Include Directories

I tried to open Additional Dependencies to change C:\Program Files\PostgreSQL\14\lib To "C:\Program Files\PostgreSQL\14\lib" but still the same error

2

There are 2 best solutions below

0
On

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 link

finally, make sure that you are configuring it in the correct platform (x86 or x64)

0
On

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.