I am trying to use OPENCV on visual C++ 2012 as a blank project. All the libraries are set and include paths are correct, however I get the "LNK1104: cannot open file 'kernel32.lib'" error while debugging the code snippet. prior to the error there is also a warning indicating:
Warning 1 warning MSB8003: Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppBuild.targets
are they related?
Make you have in VC++ directories (Right click project, Click Property Page),
Include Directories: $(IncludePath)
List item Library Directories: $(LibraryPath)
Related
I'm trying to compile with the C++ address sanitizer (project property pages / C/C++ / Enable Address Sanitizer = YES), but I'm receiving the following error on compiling:
LINK : fatal error LNK1104: cannot open file 'clang_rt.asan_dynamic_runtime_thunk-x86_64.lib'
First you should make sure you installed the Address Sanitizer as described here
Once you installed it, the library should be in your MSVC directory, it's different depending on the Visual Studio version you installed.
After you found the file, add it's folders path to the project Linker:
in Solution explorer Right click on
Project > Properties > Linker > Additional Library Directories > Edit... > New line
Recompile, now the .lib file should be available if you compile with /fsanitize=address option.
Go to your project properties, and under VC++ Directories / Library Directories, add an entry:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\lib\x64
Make sure the directory exists! In particular, note the Visual Studio build number (14.29.30133) is being used in the path, so check if yours is different.
I am attempting to compile a project in visual studio 2013 that is using boost 1.58.
I am receiving this error:
Error 3 error LNK1104: cannot open file 'libboost_log-vc120-mt-1_58.lib'
This entry is in my VC++/General/Library Directories
$(BOOSTDIR)\lib\x64
the value of my BOOSTDIR directory is
C:\Projects\boost_1_58_0
I have verified that the path C:\Projects\boost_1_58_0\lib\x64 has the "libboost_log-vc120-mt-1_58.lib" file.
What could I be missing?
I resolved the issue by rebuilding boost and then adding the new lib location as follows:
Add $(BOOSTDIR)\libs;$(BOOSTDIR)\stage\lib; to Additional Libraries
Add $(BOOSTDIR) to Additional Include Directories
I'm guessing there was a compiler mis-match between my project and whatever boost was built with (even though my coworker told me it was built using the same compiler). Or it could have been the path was wrong or missing.
I've installed Eclipse CDT so I'll be able to write and compile C code.
The compilation progress fails and the following error appears:
LNK1104 : cannot open file kernel32.lib
I've been searching for this file in my computer and found out it appears in some folders,
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
How could I "refer" eclipse to one of this certain paths so the kernel32.lib file will be found and I'll be able to compile and run C files?
EDIT
Thanks to #mux answer the LNK1104 : cannot open file kernel32.lib is now gone , but a new error appears now : LNK1104 : cannot open file 'C:\Program.lib' .
Once again, any suggestion will be helpful.
i wasted a lot of time on this...
this is the answer you are searching for
In Eclipse > Project > Properties > Paths and Symbols > Libraries tab, enclose the path to the library in single quotes:
'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\Kernel32.Lib'
There would be a warning that the path does not exist, but it should be gone after you rebuild your project.
I've the same problem, I've fixed because of installed Microsoft Visual Studio 2010 on my computer:
Right click on your C/C++ project -> Properties -> C/C++ Build -> Environment
In LIB, click on the Button Edit on the right side
Add ;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib <---- ; to separate the first auto detected path"
* Must be on the both Debug and Release configuration : else you'll get the same error *
you need to add the path to the library to your project, from the FAQ
Go to Your Project's Properties by right clicking on project's name
and selecting properties. Click on "C/C++ Build". Under Tool Settings
Tab, click on Directories. Click on The Add Button and Select
FileSystem. Select the folder with C/C++ libraries. Apply and then Ok.
The new library is included.
Edit:
The wiki seems outdated, but I did find the options relevant to linking here:
C/C++ Build->Settings->Tool Settings tab
you should add the include paths for headers (if any) to the compiler Includes and the libraries to the linker options Libraries(-l) and the library path to Library Search path (-L)
Go to:
"Project Properties>c/c++ Build>Settings>c++ Linker>Libraries"
Add library kernel32 and set search path to your library or set LIBRARY_PATH environment variable.
For "LNK1104 : cannot open file kernel32.lib" error you need to include path to kernel32.lib in Eclipse > Project > Properties > Paths and Symbols > Libraries tab
For LNK1104: cannot open file 'C:\Program.obj' error you need to make sure the path you provided earlier is inside single quote('). Reference
Hope this solves your problem.
I'm new to VS2010 and tried to compile a project ever worked in VS2008. The error looks simple:
stdafx.h(43): fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory
stdstring.h(619): fatal error C1083: Cannot open include file: 'TCHAR.H': No such file or directory
threads.h(52): fatal error C1083: Cannot open include file: 'cassert': No such file or directory
I googled and this type of error happens often in VS2010 Express version, but I'm using VS2010 Professional Edition. And I've checked, all these missing files are at the right place.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include and
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include
The thing is, other header files in stdafx.h is at the same directory as afxwin.h but didn't get complained.
I also checked the VC++ Directories of the property manager and the "Include Directories" is "$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(FrameworkSDKDir)\include;$(WindowsSdkDir)include".
Is there anything else that I forgot to check? Very much appreciated for the help.
The properties explorer is where you want to look. Afxwin.h is in ..\atlmfc\include, tchar.h and cassert are in ..\include which you'd think would be a global-type property, but it turns out it's not so simple. This is the biggest problem I had with upgrading from 2008. This is no longer an application option, it's a user property.
Before you go about changing things, look the properties explorer and read the MSBuild documentation, because, while the new format is more powerful and flexible, but it doesn't upgrade from the old format gracefully.
Visual Studio C++ 2008
I have downloaded a sample project.
I converted the project from VS 7 to VS 9.
However, when I compile I get this error:
c1xx : fatal error C1083: Cannot open source file: 'WIN32': No such file or directory
Under project properties > preprocessor definitions. I have WIN32 defined there.
I have never had this error before.
Many thanks for any suggestions,
Go to Project-->Properties-->C/C++-->General-->Additional include directories and make sure no WIN32 chars.
Make sure PATH environement variable values that doesn't exist WIN32 chars.