Reputation: 1
Similar problem to this: How to exclude .lib file from linker command line argument in VC++
Basically I was doing a school assignment that requires my c++ program to call my oracle database. I was messing around with Oracle OCCI and set the libraries "oraocci11.lib" "oraocci11d.lib" to be included to all projects by default.
I followed the settings that is explained here
After which I tried to compile a sample project from the same source to test the OCCI and got an error like this:
error LNK2019: unresolved external symbol "public: static class
oracle::occi::Environment * __cdecl oracle::occi::Environment::createEnvironment(enum
oracle::occi::Environment::Mode,void *,void * (__cdecl*)(void *,unsigned int),void
* (__cdecl*)(void *,void *,unsigned int),void (__cdecl*)(void *,void *))"
(?createEnvironment@Environment@occi@oracle@@SAPAV123@W4Mode@123@PAXP6APAX1I@ZP6APAX11I@ZP6AX11@Z@Z)
referenced in function _main
My default Linker > Command Line
/OUT:"C:\Users\Jem\Documents\Visual Studio 2010\Projects\sql\Debug\sql.exe"
/INCREMENTAL /NOLOGO "msvcprtd.lib" "kernel32.lib" "user32.lib" "gdi32.lib"
"winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib"
"uuid.lib" "odbc32.lib" "odbccp32.lib" "oraocci11.lib" "oraocci11d.lib" /MANIFEST
/ManifestFile:"Debug\sql.exe.intermediate.manifest" /ALLOWISOLATION
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\Jem\Documents
\Visual Studio 2010\Projects\sql\Debug\sql.pdb" /SUBSYSTEM:CONSOLE /PGD:"C:\Users
\Jem\Documents\Visual Studio 2010\Projects\sql\Debug\sql.pgd" /TLBID:1 /DYNAMICBASE
/NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE
If you look at the above properties there this two libraries being included "oraocci11.lib" "oraocci11d.lib"
I would like to remove those two off the Command Line but the option is in Read-Only.
After being frustrated over the OCCI, I tried to make a simple program call main.cpp with just "int main() { return 0; }" inside. I build it and I get this
LINK : fatal error LNK1104: cannot open file 'oraocci11.lib'
I included the folders containing the libraries. This time, I get this
LINK : fatal error LNK1104: cannot open file 'msvcprtd.lib'
I have tried in my notebook and it worked fine. My notebook VS2010 is a fresh install of VS2010.
So I figured it might be the command line since I have already excluded all the folders and libraries in the properties before I attempt to build with the first setting that returns the oraocci11.lib error.
I have done all the possible solutions I have found online to no avail. I have tried to undo all the settings already (Directories and Additional Dependencies) Even installing and reinstalling my VS2010 wasn't helping. Please help.
Upvotes: 0
Views: 6767
Reputation: 2520
I just had this problem. I am using Visual Studio 2010 and the solution for me was to go Project properties->Common Properties and remove the references to the unwanted libraries. That got rid of the command line entries to the libraries.
Upvotes: 2
Reputation: 1
I found a solution which worked for me so far.
At least my VS2010
is working and compiling my previous projects.
I just messed around with the Property Sheet on my computer.
C:\Users\%user%\AppData\Local\Microsoft\MSBuild\v4.0
Just copy and replace Microsoft.Cpp.x64.user.props
inside the folder to the Microsoft.Cpp.Win32.user.props
Thanks for all the input though
Upvotes: 0
Reputation: 36537
You must not link release and debug libraries at the same time: e.g. oraocci11d.lib
is the debug version; oraocci11.lib
the release version. It will confuse the linker (due to the same symbols being available in both versions, while it won't be able to determine which one you want). Also, I wouldn't add such libraries to the standard libraries to be linked against (as it might slow down linking).
Upvotes: 0