I'm trying to create a C++ Project in Visual Studio 2022, but the only problem is that I'm missing all of the Windows API headers (Windows.h, Toolhelp32, PSApi, all that good stuff), however, I do have the standard stuff, like <iostream>.
Because I do not have the Windows API headers, this means that I can not compile DLL projects.
I have tried 'Retarget solution' but it solves nothing.
Prior to all of this, I did reinstall VS entirely.
I do have the C++ and .NET workloads/packages installed with EVERY optional download for C++.
I have also tried going into the project properties and changing SDK version.
Edit:
So, adding these include directories manually seemed to fix the include errors, however, I now get an error about the version of Windows SDK.
Related
I wonder if anybody has experience converting VS 2008 C++ solution to VS 2017/19 without switching to newer SDK and toolset. The solution is quite old, very large, uses 3-rd party libraries, so full conversion is out of the question. The goal is only to switch to better user interface.
Theoretically it is probably possible, although I successfully converted only very basic C++ MFC project.
Project settings in VS 2017 show only latest toolset. To make other toolsets to appear, I had to install VS 2010, and also add SDK 8.1 from VS installer (without VS 2010, this option is not available). Then select toolset v.90 and SDK 8.1 for each project in solution.
At this point, simple converted project works fine. A large legacy solution has a lots of issues. I resolved generic ones, but it looks like uphill battle. For example, C++ directories are physically different and some of the files are missing. It may be possible to eventually assign original VS 2008 directories to each project and/or copy missing files, but I have the impression of doing something illegal.
The question is, is it a valid procedure and still possible after latest updates.
Thanks==
I've been given a legacy Visual C++ project that I need to compile in Embarcadero RAD Studio XE7, but I have a problem with building it. For now, I have a problem with ATL libraries, which are needed for some components of the project:
I already copied all ATL files from include/atl to windows/sdk/atl
the project requires atlsafe.h. I've installed Visual Studio 2013, which has these headers, but I do understand how to use them properly. In case I copy atlsafe.h to windows/sdk/atl, I start to receive lots of errors which are related to the outdated atlbase.h. Once I replace atlbase.h, I start to receive more errors (expectedly), and so on.
Generally, the question is, how do I properly configure my C++Builder project for ATL, and where do I obtain the correct version of the headers? For example, for the boost headers, the problem was solved very easy (build proper version and add path to headers to -I directive).
Embarcadero dropped support for ATL in C++Builder XE, replacing ATL with the Delphi ActiveX framework (DAX). In order to use ATL in C++Builder projects in XE and later, you need to obtain ATL support files (headers and library binaries) from an earlier C++Builder version, you can't use the ones from Visual Studio. If you don't have access to an older C++Builder version, then you will have to forget about ATL and migrate the project to DAX instead.
I have a project that uses Effects11.lib and Effects11d.lib but when I build my project I get a bunch of "error LNK2038: mismatch detected for '__MSC_VER':value '1600' doesn't match value '1800'". And from what I have found, this is saying that the .lib was built for a different version of VS than what I am using and I need to recompile them. Issue is I am not sure how to do this. Never had to recompile a lib before.
Looking through the authors site for this book # http://www.d3dcoder.net/d3d11.htm, it looks like the Effects11.lib is Ms-Pl licensed source code.
http://msdn.microsoft.com/en-us/library/windows/desktop/ff728664(v=vs.85).aspx
which then links to
https://fx11.codeplex.com/
which has a download for the source of that library at
https://fx11.codeplex.com/releases/view/150822
which seems to have project files which are buildable with VS2013 which you are using so you should be able to build effects.lib for vs2013 and continue with your development.
Alternative you could contact the author himself from his webpage and see if he can do this for you and link to it as its likely you're not the only one hitting this issue?
To recompile a .lib file, you first have to have the source code. You then open the vcproject of the library project, and then you change your settings and then you can recompile. I also found on the web that for some types of c++ in order to get it to recompile, you will have to delete the .o file generated in the library's directory. But, I do not know if that applies to your compiler. I hope this answers your question.
Those static libraries are built with VS 2010, but you are using VS 2013. The link error is telling you that.
The fix in this case is to visit the Effects 11 site on CodePlex and then build a fresh copy of the Effects 11 with your VS 2013 compiler. Alternatively, you can use the NuGet package fx11_desktop_2013 which is the same version built for VS 2013.
Note that as you are using VS 2013 which includes the Windows 8.1 SDK with the somewhat dated Luna book, you may be trying to make use of the deprecated D3DX11 library. You can certainly do that with VS 2013, but you have to make some adjustments to the project include/lib paths to get it to work. See MSDN. The Effects 11 library version from CodePlex or NuGet has no dependencies at all on the legacy DirectX SDK.
I have some general notes about that book here as well.
For a complete list of D3DX11 alternatives, see Living without D3DX.
I have recently moved to visual studio 2013 and upgrade all my c++ projects to use 8.1 of the windows SDK and the v120_xp toolset. A large majority of the projects are compiling and working fine i do however have two projects that refuse to build with several errors similar to the following error:
error MIDL2072: inapplicable attribute : [annotation] [ Field 'pDescription' of Struct 'D3D10_MESSAGE' ( Type 'D3D10_MESSAGE' ) ]
All the errors refer to the d3d10sdklayers.idl file. This occurs when the projects idl file is compiled as part of the project if i compile the file alone its fine.
Any help or suggestions are appreciated, thanks.
and upgrade all my c++ projects to use 8.1 of the windows SDK
That's where that went wrong. When you use the v120_xp toolset then you use an old version of the Windows SDK. Version 7.1, the last one that's still compatible with XP. With #include files that are different, and build tools like midl.exe that are older.
You cannot use this old version of midl.exe on the 8.1 version of d3d10sdklayers.idl. It contains attributes that it doesn't know how to process. It chokes on the _Field_size_(DescriptionByteLength) that's present in that file. Only the 8.x version of midl.exe can deal with it.
You are kinda lucky to run into this problem, there are a lot more hidden traps in the 8.1 SDK headers that will make your program fail to work properly on XP. Pretty hard to diagnose too. If you require XP compatibility then you must use the 7.1 headers. You'll have to fix to the damage you did to the projects, presumably the VC++ Directories settings. Or give up on supporting XP, the time has come.
I am trying to get an slightly older project running again. I used the code last summer just fine. Unfortunately I did not keep the VC++ project files, just the code. As such I created a new VC++ console project and selected the "empty project" option in the process. Upon adding the code and pointing the compiler and linker to the appropriate folder I compile successfully. From there I attempt to debug and receive the message
The program can't start because MFC71.DLL is missing from your
computer. Try reinstalling the program to fix this problem.
From what I see this DLL is in the Visual Studio .NET 2003 which as far as I can tell my project should have no dependency on. I am using a robotics simulation library called callisto which I suppose could depend on it. However that project seems to be gone so I can't confirm as much from the project website. How does one go about using MS development tools to determine as much? In the event that it does not, what other possible reasons would a new project depend on such an old DLL?
Note that if you are using that library in form of DLL (already compiled code that internally depends on redists of VS 2003), you can verify this by using the Dependency Walker (it is a simple .exe file that you can download here: http://www.dependencywalker.com/ and just drag-n-drop this DLL on it).
Also note that you don't need to install whole Visual Studio. Redistributable package for VS 2003 will do.
EDIT: "The Visual C++ 2003 runtime was not available as a seperate download" ~ check Where to download Microsoft Visual c++ 2003 redistributable