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.
Related
I have been trying to install the ImageView plugin for Far Manager, but I couldn't find the dll file. Instead I found the original code, but I am having trouble compiling it into a DLL.
Here is the original: https://sourceforge.net/p/farplugs/code/HEAD/tree/ImageView/
I am trying to open the files as a Visual Studio project, opening plugin.cpp and pressing Build->"Build Current Document". It starts building, and runs into a million fatal errors like this one:
C:\Users\User\source\repos\ImageView\ImageView\libfreeimage\c1 : fatal error C1083: Cannot open source file: 'FreeImage\Source\LibPNG\pngwutil.c': No such file or directory
The files aren't there, but in ...\libfreeimage\ there are a bunch of vcxproj files like FreeImageLib.vcxproj
I am new to C++, and Visual Studio, so I am not sure what I am doing wrong. Any help would be greatly appreciated.
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 trying to use the pthread library on windows. I downloaded a zip with a Pre-built.2 folder in it and followed the instruction.
What I have done so far:
all .h files from POSIX\Pre-built.2\includeinto MS VS2013\VC\include folder
all .dll files from \dll\x86dll\x86 into VC\bin
all .lib files from lib\x86 into VC\lib
In Property->Config->Linker->Input->Additional Dependencies, pthreadVC2.lib;pthreadVCE2.lib;pthreadVSE2.lib;%(AdditionalDependencies) // pthread.lib already in Inherited values
I included pthread.h inside my program and when trying to build solution, the following error appears:
Error 1 error LNK1104: cannot open file 'pthread.lib'
Can anyone help me out? Thanks.
EDIT:
The Include Directories and Library Directories are
A:\Program Files %28x86%29\Microsoft Visual Studio 12.0\VC\include;$(IncludePath)
and
A:\Program Files %28x86%29\Microsoft Visual Studio 12.0\VC\lib;$(LibraryPath)
respectively now. But I still get the same error message.
Add the folder containing the LIBs to Configuration Properties -> VC++ Directories -> Library Directories.
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)
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.