How to create DLL project in VS2017 correctly? - c++

I use Microsoft Visual Studio 2017 Community Edition and I want to create a C++ dll.library. I use the following manual:
https://msdn.microsoft.com/en-us/en-en/library/ms235636.aspx
However there is no manual for VS 2017, only for 2015 and below. VS 2017 haven't project type Win32 Console Application and it doesn't open Win32 Application Wizard dialog box.
How I can create C++ DLL project in VS2017?

Create the DLL project:
In this set of tasks, you create a project for your DLL, add code, and build it. To begin, start the Visual Studio IDE, and sign in if you need to. The instructions for Visual Studio 2017 version 15.3 come first. Instructions for earlier versions come later, so skip ahead if you need to.
To create a DLL project in Visual Studio 2017 version 15.3 or later
On the menu bar, choose File, New, Project to open the New Project
dialog box.
In the left pane of the New Project dialog box, expand Installed and
Visual C++ if required, and then choose Windows Desktop. In the center pane, select Windows Desktop Wizard. Enter MathLibrary in the
Name box to specify a name for the project.
Choose the OK button to dismiss the New Project dialog and start the
Windows Desktop Project wizard.
In the Windows Desktop Project wizard, under Application type,
select Dynamic Link Library (.dll).
Choose the OK button to create the project.
And To use this .dll in a client app follow this link.

Related

C++ win32-type project is unavailable

I use Visual Studio 2017 Community Edition for C++, but I have a problem.
I need to create a win32 project (Actually I want to create a static library (.lib)) but for some reason I don't have this type of projects available!
All what I have in the Section of Visual C++ is:
Windows Desktop
Windows Console Application
Windows Desktop Application
Windows Desktop Wizard
Windows Universal
General
Empty Project
Makefile Project
Shared Items Project
ALT
ALT Project
Test
Native Unit Test Project
Qt
What should I do to get Win32 Project Template?
or is there another way to create such a project (.lib NOT .exe)?
Desktop Wizard should allow to select "Static library" on first or second page.

Win32 Console Application missing in VS2017. How to create C++ Empty Project?

I installed the VS2017 community and I am lost: the Win32 Console Application in missing.
I don't even have template when I go to New Project and also I cannot create C++ Empty Project in VS2017.
How I can solve it?
Install all the optional tools for c++ development
then follow these steps ( Microsoft has updated its visual studio and there are some minor changes)
The new updated changed some things. Win32 Console Application is gone in the new update. Go to File -> New Project -> Visual C++ -> Windows Desktop -> Windows Desktop Wizard -> Application type: Console Application (.exe), Additional Options: Empty Project
Then have fun!
You just need to install "Visual Studio C++ core features". Don't install everything about C++. It consumes too much storage and possibly slow down your IDE.
Steps:
Open Visual Studio 2017 Installer.
Select "Individual Components" tab.
Select "Visual Studio C++ core features".
That's all.
If you are not interested in Game or Mobile C++ development you can remove your selections in "Workloads" tab to get free space in your hard drive :)

Where is the project wizard in VS 2017?

I want to create a static library which I want to use in other projects in VS2017 Community but I can't find the right way.
I tried to follow the instructions from here which is for VS2015 but when I want to create a new project I can just provide the name, solution name, location of solution and whether I want to create a directory for the solution or not and with git repository or not.
I remember a project wizard where I could deselect precompiled headers and set the output to a static library.
Did something change or am I missing a component?
Updated answer:
Create new project and under Visual C++ -> Windows Desktop there is a project template called Windows Desktop Wizard which will open the project wizard.
From VS 2017 15.3 Release notes (credits to user VTT from another question)
The Windows Console and Desktop Application templates now create the projects without displaying a wizard. There's a new Windows Desktop Wizard under the same category that displays the same options as before.

Can't create C++ console application in Visual Studio 2013

I downloaded Visual Studio 2013 from official site. But I can't create a new console project, as I've seen in some tutorials. The reason is that there is no console application in templates for C++.
May be there is another way to create a new console application?
That's Visual Studio Express for Windows, which is used for Windows Store and Windows Phone apps.
To do Windows desktop apps you need Visual Studio Express for Windows Desktop.
Or, of course, you can use e.g. the MinGW g++ compiler, and some general IDE such as Code::Blocks or Eclipse. But Microsoft's help system is very useful. And currently g++ only supports the Windows API as it was with Windows XP, no newer stuff.
I found a way to create a Console project no matter what version of VS Express you are using.
Create any type of project (i.e. A basic "class library" project).
Right-click the project in Solution Explorer and click Properties. You'll see a dropdown for "Output type". Select "Console Application".
Create a Main method somewhere as an entry point into the app. Doesn't matter what class you put it in.
class Program
{
static void Main(string[] args)
{
Console.WriteLine("We made a console app");
Console.ReadKey();
}
}
I did this with "Visual Studio 2013 Express for Web", so I'm not absolutely certain what your mileage will be on other flavors.

Using Visual Studio 2012 IDE, but compile with Visual Studio 2008

Where I work, we are stuck on VS2008 and will be for quite some time as converting the projects/solutions and integrating them back into our build process would take significant time; we're planning on moving to 2013 at some point though. However, I use VS2012 at home and love a lot of the features in the IDE that are missing in 2008.
I've read that you can use 2012 as an IDE and build with the 2008 compiler, but I can't find details on how this is accomplished. Any ideas? If I open one of the masterbuild files in 2012, it inevitably asks to convert them to the 2012 format, which I really don't want to do.
Thoughts? Thanks!
Yes it is possible as can be found on the Visual Studio site. However, I believe it will only give you options of the versions you have currently installed on the machine in question.
Here are the steps as laid out in the link, provided here to ensure the information link does not get broken:
(authored and published by Microsoft)
To change the target Framework
In Visual Studio, in Solution Explorer, open the shortcut menu for your project and then choose Unload project. This unloads the project (.vcxproj) file for your project.
Note: A C++ project cannot be loaded while the project file is being modified in Visual Studio. However, you can use another editor such as Notepad to modify the project file while the project is loaded in Visual Studio. Visual Studio will detect that the project file has changed and prompt you to reload the project.
On the menu bar, select File, Open, File. In the Open File dialog box, navigate to your project folder, and then open the project (.vcxproj) file.
In the project file, locate the entry for the target Framework version. For example, if your project is designed to use the .NET Framework 4.5, locate v4.5 in the element of the element. If the element isn't present, your project doesn't use the .NET Framework and no change is required.
Change the value to the Framework version you want.
Save the changes and close the editor.
In Solution Explorer, open the shortcut menu for your project and then choose Reload Project.
In Solution Explorer, open the shortcut menu for your project and then choose Properties. In the Property Pages dialog box, in the left pane, expand Common Properties and then select Framework and References. Verify that Targeted framework shows the new Framework version.
To change the project toolset
In Visual Studio, in Solution Explorer, open the shortcut menu for your project and then choose Properties.
In the Property Pages dialog box, open the Configuration drop-down list and then select All Configurations.
In the left pane of the dialog box, expand Configuration Properties and then select General.
In the right pane, select Platform Toolset and then select the toolset you want from the drop-down list. For example, if you want to compile with the Visual Studio 2010 toolset, select Visual Studio 2010 (v100).
Choose the OK button.
Try to use CMake. It could manage out of source build. You could create a VS2012 for edit and another VS2008 based for compiling. The source will be common.
From Visual Studio 2012 Compatibility page on MSDN
Some solutions, projects, files, and other assets that you created in
Visual Studio 2010 Service Pack 1 (SP1) will run without modification
in Visual Studio 2012, but others have to be upgraded.
If your original project is 2008 then you won't be able to use it in 2012, sorry.