I'm really new to visual studio and programming in general. I'm using Visual Studio Community 2015 Desktop Version (from what I know).
I can't find a Windows Forms Application from the C++ category, while there is one for C#.
Can anyone help, do I need to download another version, a plugin, or anything?
Sorry if a stupid question, I just really can't figure it out!
There are no C++ Windows Form templates in Visual Studio 2015. As I see it, you have two choices:
When creating a new project, You will see an online dropdown, click that and try to search for "C++ Windows Forms".
Create an empty C++ CLR project and add a Windows Forms to it. This link puts it like this (credit to the onContentStop, the user who posted this):
Make a "CLR Empty Project".
Press Ctrl-Shift-A and create a Windows Form (under UI).
Inside the CPP file that is created, paste this code, replacing anything in square brackets except [STAThread] with the appropriate names:
#include "[FORM NAME].h"
using namespace System;
using namespace System::Windows::Forms;
[STAThread]//leave this as is
void main(array<String^>^ args) {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Application::Run(gcnew [PROJECT NAME]::[FORM NAME]);
}
Right click your project in the Solution Explorer and click Properties.
Under Configuration Properties > Linker > Advanced, change Entry Point to "main" (without quotation marks).
Under Configuration Properties > Linker > System, change SubSystem to "Windows (/SUBSYSTEM:WINDOWS)" (without quotation marks).
Though this has already been answered, I feel like this might help those who stumble across this in the future. While creating a new project, directly above the text field for naming your project, there is a blue link that reads "Click here to go online and find templates" If you click that link it will direct you to templates that are available for you to download & use. Simply use the hierarchy on the left hand side and navigate to Visual C++ and you should be able to simply click "C++ Windows Forms" and it will create the new project, while also downloading and installing the template for future use. So, next time you go to create a C++ Winform you wont have to search for it again.
Click File-New-Project
Click online
Click/ Expand Visual C++
Click windows form application
Click C++/CLR Windows Forms fur Visual Studio 201..
Write project Name And Click OK.
Download and enjoy!!
Related
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.
I am using Microsoft Visual Studio 2010 Professional and have been looking at how to change the icon of my program. One of the solutions suggested I go to the project's properties and in the project designer, click the app section and that I would be able to edit what the icon file is.
My problem is this: When I open the properties of a project, it gives me this
window
From what I understand this is the property page. This is not what I'm looking for. I am told that the project designer looks something like this:
Project Designer
How can I alter my project so that when I click the property setting, it allows me to open the project designer instead of this? Or, how else can I access the project designer?
The first window you showed is the one we get for the properties of a c++ project. The second one we get it for the properties of a c# project.
I have excactly the same problem as you. I need to change some compiler settings.
In Visual Studio 2012, I usually use C# applications, which work fine. Now that I feel like I have a strong grasp of C#, I've decided to move on to C++. I have changed no preferences. All of my C++ projects say that the project is out of date. Here are my steps:
File -> New Project
Click "Visual C++" tab -> Win32 Console Application
Change nothing and click OK
Click Finish for the Win32 Application Wizard
Press F5 to run, or click the button (which says "Local Windows Debugger").
I'm not sure if I'm making a mistake or if there are missing dependencies. My question is, what is causing this and how can I prevent this message? If you don't know, then what are some things that I can do to find out?
what is causing this
=> Two possible reasons :
you just created the project and have not built it before trying to launch it
OR you made some changes to the project files and tried to launch the application before building the project
how can I prevent this message?
Tick "Do not show this dialog again" and click yes : your application will automatically be built every time you want to launch it.
OR always build the project before launching it
I'm trying to do some tutorial C++ programs to familiarize myself with the language. I'm using Visual Studio 2010. I have a Visual Studio solution with two projects - I'll just call them projectA and projectB. Each project has a source file with its own main method. However, when I try to run the program in projectB, the program in projectA runs instead. I'm coming from an Eclipse IDE where projects separate the programs. I've some msdn articles on solutions and projects, but I haven't seen anything about being unable to have multiple source files with main methods in them. Can someone help to clarify the Visual Studio Solution/Project structure for me, please.
Right click on the project you want to run, and select Set as StartUp Project
You have to right click on the project and "Set as Startup Project" to tell Visual Studio which project you want to actually run.
I hope this is a nice simple fix: if you look at your solution and have both projects open, you should be able to right click one of them and set it as default (Set as Startup Project), (which sounds like at the moment is set to projectA).
I have highlighted the relevant option in the menu picture:
Either you can right click on the project in the Project Explorer and select Set As StartUp Project or you can use meny item Project and also select Set StartUp Project.
quick question, im just trying out VS2012 and trying to make a c++.net app but for the life of me i cant find the option anymore when making a new project.
In vs2008 it used to be under new project>visual c++> CLR>windwos form application.
Have they removed the option to make c++/CLR application in .net from vs2012? Or is it something i must download?
Although Microsoft removed the option to create a C++/CLI Windows Forms application, the template files are still installed. The only thing missing seems to be the .vsz files and a registration in the vcNET.vcdir file. I have recreated these files and put them up for download here.
Install the files and you should be able to create WinForm apps in C++/CLI again.
Well, many people have faced this problem. Here is what I follow:
Create a Visual C++ --> CLR --> CLR Empty Project (Obviously you specify the Name and the Directory).
Once it gets created, right-click on the project and select "Add --> New Item".
Under the UI tab, select "Windows Form". Name your form and click OK. This form would get added to the project.
After the form gets added, copy the following code inside the YourFormName.cpp:
using namespace System;
using namespace System::Windows::Forms;
[STAThread]
void Main(array<String^>^ args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Project1::MyForm myForm; //NameOfProject::NameOfForm instanceOfForm;
Application::Run(%myForm);
}
We're almost done...
Now under the Project Properties, expand the Linker section and select "System". Under the subsystem option, choose Windows(/SUBSYSTEM/WINDOWS)
Now add an entry point. Under the "Linker-->Advanced", choose "Main" as the "Entry Point"
Build and Run..Voila!!
P.S.: This is only an empty form ;)
Yes, microsoft has removed the option, here is the response from microsoft (reference):
C++/CLI is a great solution for interop, but we do not recommend
creating brand new UI applications using C++/CLI.
The workaround provided by the link is:
Create an empty C++ solution with both 2012RC and MSVC2010 Express.
Using 2010 Express, create a new WinForm App project inside the folder of the 2012RC empty solution. Close all saving.
Using 2012RC and the "add existing project", add the 2010 Express-WinForm App project into the empty 2012RC solution.
Right click on the project to convert it to 2012RC "format"
It works and it is simple! But I don’t know all the consequences.
Creating the template by yours self:
Create an empty C++ solution with both 2012RC (New Project -> Other Project Types -> Visual Studio Solutions -> Blank Solution) and MSVC2010 Express (New Project -> Visual C++ -> Empty Project).
Using 2010 Express, create a new Windows Form App project (name it “myWForm11” or so) inside the folder of the 2012RC empty solution. Close 2010 Express saving all.
Using 2012RC and the "add existing project", add the 2010 Express-WinForm App project into the empty 2012RC solution.
Right click on the solution to upgrade VC++ projects to 2012RC "format"
FILE -> Export Template ... -> Next> Type in Template name: "Windows Form App, C++ 2012RC" or so and some description too.
Finish
Close solution
Now you can create WF App in 2012RC “as always” (New Project -> Installed -> Templates -> Visual C++ -> Windows Form App, C++ 2012RC).
It works and it is simple! But I don’t know all the consequences.
I just created a new project in VS2010.
Then import it into VS2013.
You will find the form designer doesn't always work with this.
Change the source file slightly and save it.
The form designer will then wok ok until you load in the project again.