Using old code on new version of Visual Studio - c

I have a project which was started from 90s in C/C++. Therefore, it contains many old coding styles such as K&R-style function declaration, obsolete function, ...
The project works fine in Visual Studio 2008, but now I want to use it in the new version of Visual Studio (specifically VS 2010) because we have other projects in Visual Studio 2010/2012. I don't want to have too many versions of Visual Studio on my machine.
When I try to compile the old project, Visual Studio throws too many errors. I can fix all of them but I am scared to edit the source code and I want other people to be able to pen it in the old version of VS too. I want the project to remain backwards compatible with VS.
My question is how to use the old code in Visual Studio 2010/2012 without changing the code. Or if necessary how do I just fix a few lines of code, but make sure it won't cause an error if someone else opens that code in the older version of VS. Is there a way to tell newer Visual Studio versions to use older compiler flags or something like that?

Best option is IMHO to bite the bullet and install VS 2008 and VS 2012 both on your machine, and then use the V90 platform toolset within VS 2012 (that means, you can edit and debug in VS 2012, but VS will use the old VS 2008 compiler and debugger under the hood).
What you don't get that way, however, is backward compatibility concerning project files. VS 2012 is only backwards comptible to VS 2010, but not to VS 2008. If you need that really, you either have to maintain two versions of your project files (one for VS 2012 and one for VS 2008), or you must stick to VS 2008 as an IDE.

Related

How to compile zlib into a DLL on Visual Studio 2017?

I have a hard time trying to do something I think is really simple (I must not be the first one to want to do that). I use Visual Studio 2017 on Windows 7 to do some C code, and I need inflate/deflate for zip.
I search a little, and I found zlib. It seem to be exactly what I search: free, cool copyright, no patent and extensively used and tested in other project.
So, I start to download the latest version (zip of 1.2.11) and here I go, trying to "simply" get the DLL.
However, the documentation state that in order to compile "zlib1.dll", I have to use "./contrib/vstudio/vc..", with ".." the right Visual Studio. But I have Visual Studio 2017 and there are only "vc9" to "vc14", "vc14" being Visual Studio 2015.
The doc say that I have to use Microsoft Visual C++ 2015, and indeed, when I force open with vs2017, I have integrity error.
So I try to install MVC++ 2015, but then it say that I can't install it because I already have something (VS2017) installed.
Is there really no way to achieve something so basic, or there is knowledge that I don't know?
Open source projects can be a challenge to build as their support tends to lag well behind the latest versions of Visual Studio. This is one reason why Visual Studio now supports cmake directly.
That said, the easiest way to build zlib for Windows is just use a NuGet package. I personally use zlib-msvc14-x86 or zlib-msvc14-x64 which are binary compatible with VS 2015 Update 3, VS 2017, and VS 2019. They also provide a static library instead of a DLL.

How to install Visual C coding tools to Visual Studio 2015?

I have an older Visual Studio solution with source code of Quake III Arena (a first person shooter game from 1999). It has also source codes of number of useful tools, which need to be edited in order to work with a new game made from Quake 3 engine. All of this code was written in C and in order to work with this older solution (may switch Visual Studio to compatibility mode), I need to first install Visual C tools into my Visual Studio 2015 Community edition copy.
But Google doesn't help much. It still wants me to download Visual C++, but that's something I already have. Visual C is missing and without it the older solution won't work. Is it possible? I want to test making own modification of the game, creating whole new game out of the engine and modifying the tools needed to create assets for the new game, add them new game as an option. Should I download older Visual Studio instead if there is no Visual C for new VS? Where do I download Visual Studio 2008, the one in which the source code was packed?

Trying to build Mozilla got this error when trying to open start-shell-msvc2015

I am trying to build Mozilla on Windows 7 64bit
I tried to run this start-shell-msvc2015.bat but got this error.
MozillaBuild Install Directory: C:\mozilla-build\
Visual C++ 2015 Directory: C:\Program Files (x86)\Microsoft Visual Studio 14.0\V
C\
Windows SDK Directory: C:\Program Files (x86)\Windows Kits\8.1\
Unable to call a suitable vcvars script. Exiting.
Press any key to continue . . .
I did everything according to their instructions
When in doubt, search Google for the error message. From the first result:
Hallvord R. M. Steen:
To anybody else who might have this problem: it's caused by choices made during installation, and the installer options were somewhat confusing. I don't remember the exact details, but I think the "Default" installation no longer gives you the required scripts - the "Default vs custom" section on https://msdn.microsoft.com/en-us/library/e2h7fzkw%28v=vs.140%29.aspx seems to confirm that you need to choose "Custom" during install and enable Visual C++ tools specifically.
Andrew Overholt: You're right, Hallvord. I went back to my VS2015 installation .exe download, clicked "Modify [the existing installation]" and picked "Common Tools for Visual C++ 2015" under "Programming Languages" > "Visual C++".
Also you'll need at least update 3 if you're using the VS2015 Community Edition. From that Mozilla dev docs page:
Once you’re up to date, download and install Visual Studio Community 2015 Update 3 from Microsoft. If you have an earlier version of Visual Studio, you'll need to upgrade; Firefox relies on C++ features that aren't supported in older versions of Visual Studio. Do not accept the default configuration. Instead, select **Programming Languages > Visual C++ > Common Tools for Visual C++ 2015.*
See also this question on Super User.
Furthermore, the MDN docs actually were updated with this info after that report, and indeed the current build instructions contain, in bold:
Be sure to install the "Common Tools for Visual C++ 2015", which requires a customized installation in Visual Studio 2015.
In the prerequisites section.
Also you'll need at least update 3 if you're using the VS2015 Community Edition. From that Mozilla dev docs page:
Once you’re up to date, download and install Visual Studio Community 2015 Update 3 from Microsoft. If you have an earlier version of Visual Studio, you'll need to upgrade; Firefox relies on C++ features that aren't supported in older versions of Visual Studio. Do not accept the default configuration. Instead, select Programming Languages > Visual C++ > Common Tools for Visual C++ 2015.

Unable to open SSIS project in Visual Studio 2012 or 2013 (migration fails)

I am trying to open a solution file in Visual Studio 2013 Ultimate that includes an Integration Services project (.dtproj). Unfortunately, the migration failed for reasons that are slightly baffling to me.
The migration report contains the following error:
RecommenderJobs.dtproj: The application which this project type is based on was not found. Please try this link for further information: http://go.microsoft.com/fwlink/?prd=12395&pver=11&sbp=ProjectTypeDeprecated&plcid=0x409&clcid=0x409&ar=MSDN&sar=ProjectCompatibility&o1=159641D6-6404-4A2A-AE62-294DE0FE8301
Unfortunately, the link appears to be dead, so that's no help.
I also received the following error message when I tried to open this in Visual Studio 2012:
I've tried opening this solution in both Visual Studio 2012 Ultimate and Visual Studio 2013 Premium (which is why I tagged both). Both are on Update 5. I already tried updating all of my extensions and updates, even ones that seem like they wouldn't be directly relevant to the problem (like Visual Studio's Office tools).
I found a similar question on Microsoft's forum. The suggestion there was to upgrade my version of SSIS to the latest version. I tried to install SSDT for VS2013 as suggested, but the install failed:
When I checked the logs, it had the following error:
Error 0x80070666: Cannot install a product when a newer version is installed.
I do, in fact, have a different version installed, but it's not actually newer as far as I can tell (in fact, it launches in the Visual Studio 2010 shell), so I'm a little confused by this. The version information is below:
Microsoft SQL Server Integration Services Designer
Version 11.0.5058.0
Microsoft SQL Server Reporting Services Designers
Version 11.0.5058.0
I do also have tools related to SQL Server 2012 installed.
Based on what I've read in other posts, I'd expect to see the SQL Server Data Tools in "Add/Remove Programs," but it's not. Does anyone know why that might be?
I've also seen related questions for other types of projects, such as for a PowerShell project. (Obviously, my question has nothing to do with Powershell, but the OP there was receiving the same exact error message for a different project type). Unfortunately, the suggestions on that post didn't seem all that helpful - for example, the accepted answer there involved completely uninstalling and reinstalling Visual Studio, which would be a major pain to say the least. I'm also not all that confident that that would work for me since this problem occurs in two separate versions of Visual Studio.
Does anyone have any suggestions on what else I could try?
You likely need to install both Integration services and Business Intelligence for Visual Studio (BIDS). You can do it launching SQL Server Setup and adding features to your current SQL Server Instance.
Have a look at this one: https://guruprasadv.wordpress.com/2009/06/17/opening-ssis-package-in-visual-studio/
BIDS is the IDE (integrated into Visual Studio) that allows you to drag and drop the components and create the SSIS packages. From SQL Server 2014 on wards you won't see BIDS anymore packaged in the SQL Server Setup, so you will have to install it independently. If you need it for VS 2013 here you have the link: https://www.microsoft.com/en-us/download/details.aspx?id=42313

Is it important that Visual Studio 2008 thinks it's the wrong edition?

I installed Visual Studio 2008 Standard Edition a month or so ago after a reformat (on Vista64, if that matters). I got it for free from one of those "Heroes Happen Here" launch events.
I then installed SQL Server 2008 Express Edition a week or so ago (we're supposed to be getting that for free in the mail but I gave up - a little too early apparently).
Before I installed SQL Server 2008 Express, when I would start up Visual Studio 2008 the splash screen would read "Visual Studio 2008 Standard Edition". Now it says "Visual Studio 2008 Shell".
I figure that for whatever reason the VS2008 skeleton that ships with SQL2008 Express has stepped on the VS2008 skeleton I had there already. I know that if you install SQL2005 on a machine without VS2005, you get a "shell" version of VS2005 with no languages installed (no C#, VB.NET, etc.)
I figure this is no big deal since at worst some registry setting somewhere is wrong and the splash screen is just confused. But am I right? Or is this something that will bite me later when VS2008 for some reason denies me some feature?
To be honest, I wouldn't tempt it. This is sort of like a knock in the engine, but the car drives fine. Then one day you get stranded on the side of the road (or maybe not.) I would suggest an uninstall and a reinstall to be safe. I've had a similar run in with Visual Studio 2008 and that's exactly what I ended up doing.
I'd leave it alone. However, if the engine in my car knocks, I'm getting it rebuilt NOW while the fix is minor, rather than waiting for the catastrophic failure (voice of experience here). :-)
My experience with this on a couple machines is that there is nothing to be concerned about. If you look at the about screen within Visual Studio it should be telling you all the correct information. If your start it from the run command using "devenv /splash" you will likely see the correct splash information displayed too. If you want to get the correct splash screen to show everytime, edit your Visual Studio 2008 shortcut and clear the value from the Start In directory.

Resources