C++ GUI: Install C++ CLR Workloads in Visual Studio | WinForms
Вставка
- Опубліковано 20 сер 2024
- One of the most common questions I get on my channel is "How do I set up Visual Studio for C++ CLR Windows Forms Application Development?".
In this video, I am going to teach you each and every step required.
Visual Studio is one of the best IDEs and hopefully, it gives us the opportunity to build C++ GUI apps in an easy way with C# interop. However, to make a C++ GUI application, certain components are required to be installed in addition to just the C++ Desktop Development Workload. Let's say that you installed everything. In that case even, you won't see a template code C++ Windows Forms. Therefore you need to create it manually.
Visit Us : sciber.dev
Here is the code to paste in the MyForm.cpp file 3:42
#include "MyForm.h"
using namespace System;
using namespace System::Windows::Forms;
[STAThreadAttribute]
int main(array^ args) {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
ProjectName::MyForm form;
Application::Run(% form);
}
Copy the whole thing and paste it in the cpp file. Change "ProjectName" to the name of your project and change "MyForm" to the Windows Form's name.
Oh, help me..
i did the same 100% but it doesn't work and gives error
Severity Code Description Project File Line Suppression State
Error (active) E0020 identifier "string" is undefined Project2 D:\Code\ProjectCpp\Project2\MyForm.cpp 8
Severity Code Description Project File Line Suppression State
Error C2065 'string': undeclared identifier Project2 D:\Code\ProjectCpp\Project2\MyForm.cpp 8
Severity Code Description Project File Line Suppression State
Error C2059 syntax error: '>' Project2 D:\Code\ProjectCpp\Project2\MyForm.cpp 8
Severity Code Description Project File Line Suppression State
Error C3699 '^': cannot use this indirection on type 'unknown-type' Project2 D:\Code\ProjectCpp\Project2\MyForm.cpp 8
what is this code
the visual part of visual studio was missing for me until this thanks
I love how you didnt skip the part about what to paste in the main cpp. many vids about this topic skip that part and its a critical part
We have a C++ GUI project in my CS class right now, this was incredibly helpful. The instructions we were given are only for VS 2017 so it didn't have the 2 versions of CLR project to choose from when creating a new project. Thank you so much!!!
Good job man. This must have taken you lots of time to figure this shit out. Keep it up!!!
Thanks man ❤️
tthank you so much dude u went straight into it and didnt talk heaps of bullshit, respect dude u saved my life !!!!!!!!!!!!
Thank you so much! I was looking all around on YT for a good and simple start.....
Although its not exactly the same code (my project is "CLRStuff"), here's the code from 3:44. Why not just post it (The OP) in the comments for the video ?
#include "MyForm.h"
using namespace System;
using namespace System::Windows::Forms;
[STAThreadAttribute]
void main(array^ args) {
Application::SetCompatibleTextRenderingDefault(false);
Application::EnableVisualStyles();
CLRStuff::MyForm myFrm;
Application::Run(% myFrm);
}
Thank you very much for this tutorial, this helped me a lot
Simply put, well done! 👍👍 Microsoft should fix this issue within VS as the IDE should just work without these extra steps.
Oh yeah, the problem is this is not an issue. It's just that Microsoft discontinued this. This is kind of deprecated now.
BEST TUTORIAL EVER!!!!!!
Amazing 🤗 care for a sub 😇
Thank you so much! You just helped my entire class ahah
Also I made a Visual Studio Extension to add this template so you won't have to go through the hassle each and every time you need a project, check the video here: ua-cam.com/video/ymTCXDGakj4/v-deo.html
Damn.. it's working now!! Thanks, sir, you give me a new life right now
HaHa nice to hear ♥
You saved my life, thanks.
😂😂😂 🔫
I followed the video exactly but after running it I got the message: ''Unable to start program 'C:\User\TCP\source
epos\Project1\x64\Debug\Project1.exe'
The system cannot find the file specified''
Please guide me!!!
me too🥺🥺. Have you fixed it yet, can you help me? Please
Thanks sir. It worked for me🙏
thanks man very helpful
You helped a lot bro, well done !!!
I cannot use #include with C++ CLR project. It gives error.
Fantastic.... works like a charm
Thank you very much! You helped me!
Your video quality is very clear..
Gotta respect the freenom domain name though!
thanks this was very helpful :)
thanks for this man
really helped
Thanks, working, you helped me a lot!
This has saved my day bro thanks for sharing
I kindly request for a video on how to install mySQL database and how to link it and use in visual studio 2019
Thank you very.... much!
It really works!Thank you again sir!
❤️
Nice video, it worked... Nicely explained, thanks.
Thank you 💓 hope for more
😀👊
Thanks for your really great videos.
don't know if anyone else is having this problem but I was getting an error saying entry point is not defined even though I set it to main. This was solved by making the main "int main" rather than "void main"
it was just a warning for me, so i neglected it. thanks for mentioning it. I will change the code.
Best background soundtrack ever
very helpful.thanks
Thanks a lot! 👏👏
Thank you so much!!!
You're welcome!
Thanks a lot!
Then why am i gettinh errors LNK2001 and LNK2019 with the entry point
Mannnnnyyy mannyy Thanks Bro..
Love You
😅😊
all setting goes well. but when I again open to load designer form windows. the windows open but when I build it shows the error "MSCV.lib" not found
Could you dm me on instagram.com/thisismalindu
Bro why did you select visual c++ in this installer what if i choose general for c++ (which to select)
To which section are you referring to please provide timestamp 😊👀
@@wearesciber 2:28
Development settings
Oh that's just nothing. It doesn't matter anymore since the new project dialog has changed. You can select whatever you want.
@@wearesciber which is better for c++ select general or visual c++
Good Video, Good Music Men, Thanks
It worked!
nice
Thank you for your tutorial. I would like to ask one quastion: Tell me please, how I can use Excel in CLR project?
thanks for tutorial
Thank you bro
Awesome video! Can you do a video on using *threading* with a CLR GUI project?
Apparently CLR doesn't have access to the main library's threading functions/abilities. But I've read that there are other ways to do it?
I have error the entry point must be defined and the system cannot find the file specified how can i solve it
thank you so much
i have an error called " show call stack" like the video but when i close it and reopen it show the same error again any ideas
Any idea how to fix this?
I have 2 problems :
1.
Warning MSB8003 The VCToolsInstallDir property is not defined. Some build tools may not be found. Test C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets 494
2. Error TRK0005 Failed to locate: "CL.exe". The system cannot find the file specified. Test E:\Other\CODING\Test\Test\TRACKER 1
How to fix this??? Can anyone help me pls
---------------------------
Microsoft Visual Studio
---------------------------
Unable to start program 'E:\LUUHAIHOA\c++\MyProj\graphics\MyProject\x64\Debug\MyProject.dll'.
The system cannot find the file specified.
---------------------------
OK
---------------------------
Good job, thanks...
it doesnt work it says error lnk2001 and lnk1120
Are you sure you did everything correctly. Might wanna check twice
the link to the code for the .cpp file isn't working anymore... Can somebody tell it me please?
Check the pinned comment please.
do you mind please telling me why that code is necessary and what it does?
That code is responsible for making an object of the MyForm class. Then it uses some other methods to render the form into the screen. If you could take some time and slowly read the code even you can understand it yourself. 😉😊
@@wearesciber appreciate it
i really hope it well work with my latest version of studio
im using windows 11 and it keep saying it has build errors, it only loads the empty format and no buttons
how do i fix this pls?
Can you send the project you created to our telegram group
t.me/wearesciber/1
cool video)
When showing what to do, you go to fast I cannot keep up with your mouse movement and what you are saying :[
thank you very much!
Why didn't you explained wtf was going on ? :(
thank you so much!
there's nothing in my toolbox, im currently using visual studio 2022, please help
Same bro
Hi Sir, please put a video on, How to change language in Visual C++ Winforms. it always gives resource manifesto error.
Need a video on Topic "Localization from English to Japanese on a button click"
i dont have toolboxs' thing. what do i do?
Why do we have to do all this ? Microsoft cannot add an option to create it by default ?
i think it is because the recommended option is to use C# and invoke C++ code through it when needed.
C# Winforms is well documented as well.
now if you want something like a template i've uploaded one to the vsmarketplace and also made a video about it.
marketplace.visualstudio.com/items?itemName=Sciber.cppwinformsproject
ua-cam.com/video/ymTCXDGakj4/v-deo.html
great tutorial
bro I have a question. I know c++ can I do that on 4 gb ram computer ?
nice music
Wait, is that your name 😂
Thank you
Does this C++ support and ?
thankyou:)
System Could not find projectname.exe in my project. So would you please help me with these?
could you give me 2 weeks and i will help you with the problem, I am stuck with my exams right now. In about 2 weeks they will end. :)
can we make games without using graphics.h library in cpp
Instalé lo que el dice pero sigue sin aparecerme, que puedo hacer?
(Windows) Panel de control -> Add o Quitar programas, Selecciona Visual Studio Installer -> Modificar; en esa ventana en 'Componentes Individuales' elige/busca CLR 14.26, aprieta modificar (tarda unos minutos en descargar), y mas o menos 1 Gb de espacio en disco. Recuerda tener instalada el workload Desktop C++. A mi me aparece la nueva opción, pero al crear el main form me sale un error y no puede compilar, es necesario copiar/pegar el código de 3:41 al archivo MyForm.cpp para compilar sin errores.
Además, puede encontrar el contenido dentro del archivo main.cpp como un comentario anclado en la sección de comentarios.
great! deleted my VS2019 and then reinstalled with the following instructions, because you didn't explain what to do if it's already installed, good job
Oh I'm sorry about that, I actually forgot. But I'm glad you got it in the end anyways ♥ 🔥
thank you very much i have searched for this a lot and didn't fined any thing
Glad I could help 👊
thanks 😊
do I still need to do this in 2022? I mean writing this code and the configuration
Yes even Visual Studio 2022 doesn't have the templates because Microsoft abandoned it. But I made the process much easier by making a template, so you don't have to go through the process shown in this video. Here watch this one to learn more: ua-cam.com/video/ymTCXDGakj4/v-deo.html
Or you can install the template and start right away: marketplace.visualstudio.com/items?itemName=Sciber.cppwinformsproject
Merci mon gaté
Instructions on how to set up Visual Studio 2019 for C++ development, including downloading necessary components and creating a project.
[00:07](ua-cam.com/video/HcxlYkU8aY0/v-deo.html) Setting up Visual Studio 2019 for Windows Forms development is challenging
[00:44](ua-cam.com/video/HcxlYkU8aY0/v-deo.html) Install necessary components for desktop development
[01:19](ua-cam.com/video/HcxlYkU8aY0/v-deo.html9) Download and install C++ with C++ CLI support
[01:53](ua-cam.com/video/HcxlYkU8aY0/v-deo.html) Install and launch Visual Studio
[02:23](ua-cam.com/video/HcxlYkU8aY0/v-deo.html) Setting up a C++ environment for creating projects
[02:58](ua-cam.com/video/HcxlYkU8aY0/v-deo.html) Creating GUI applications using Dutton framework
[03:31](ua-cam.com/video/HcxlYkU8aY0/v-deo.html) Fix form error in CPP file and pom.h
[04:05](ua-cam.com/video/HcxlYkU8aY0/v-deo.html) Learn to develop Visual C++ Windows Forms applications
---------------------------------
Detailed Summary for [C++ GUI: Install C++ CLR Workloads in Visual Studio | WinForms](ua-cam.com/video/HcxlYkU8aY0/v-deo.html) by [Merlin](merlin.foyer.work/)
[00:07](ua-cam.com/video/HcxlYkU8aY0/v-deo.html) Setting up Visual Studio 2019 for Windows Forms development is challenging
- Download the web installer from the official website
- Launch the installer and wait for the installation to complete
[00:44](ua-cam.com/video/HcxlYkU8aY0/v-deo.html) Install necessary components for desktop development
- Click on 'Use Your Studio' and install Community 2019
- Select desktop development and install C++ CLS support for version 140
[01:19](ua-cam.com/video/HcxlYkU8aY0/v-deo.html9) Download and install C++ with C++ CLI support
- Select 'Desktop development with C++ CLI support for version 142 build tools'
- Click 'Download all' and then 'Install' to download and install all required files
[01:53](ua-cam.com/video/HcxlYkU8aY0/v-deo.html) Install and launch Visual Studio
- Download and install Visual Studio, then restart computer
- Launch Visual Studio from Start menu or installer, create Microsoft account if desired
[02:23](ua-cam.com/video/HcxlYkU8aY0/v-deo.html) Setting up a C++ environment for creating projects
- Skip the existing setup and set up the family environment as C++
- Create a project by searching for CLR and choosing between dotnet core and dotnet framework
[02:58](ua-cam.com/video/HcxlYkU8aY0/v-deo.html) Creating GUI applications using Dutton framework
- Choose location and name to create project
- Change subsystem to Windows and entry point to main, then add UI windows form
[03:31](ua-cam.com/video/HcxlYkU8aY0/v-deo.html) Fix form error in CPP file and pom.h
- Add code to CPP file after adding form
- If form not visible in pom.h, close and reopen Visual Studio
[04:05](ua-cam.com/video/HcxlYkU8aY0/v-deo.html) Learn to develop Visual C++ Windows Forms applications
- Load the application and add components from the toolbox
- Check out more videos on the channel for further learning
Ok I installed by watching another tutorial and they just said to install desktop development with c++ without any change...So I didn't check c++ CLI support. It took such a long time to get installed so I can't simply uninstall and install again. Is there any way of installing the support after the app is installed?
You can install the cli think individually, just go to individual components and search or find it yourself. Just check the box on that and dont touch anything else (really dont 😂 the installer is cursed) and install. It should work.
THANKS BROOO
Please what if I already have the VS 2019 installed ? .... Do i need to un-install everything and start all over again ?
No, just launch the VS installer (search for it in the start menu) and then do the rest (install the workloads).
Sir its getting erorrs like form is not defined and expecting" ; " but i entered correctly that source code
Its because you renamed the form or project when creating them. You need to replace the code with appropriate project and form names
Thanks
Yes
I have no UI
thank you :)
thank you :D i think visual studio 2013 has not this problem
Yeah man. You know this is microsoft and over the years their products get confusing! Lol 😂🔫
I have a question .. why do we need to paste a program code to the forms ?
It's some code included in the origin template (available in vs2010). It basically renders the windows form to the screen.
Hi If I am using windows 11, should I install Windows 11 SDK component or window 10 SDK‽ They say windows 11 SDK not stable yet.
Please advice me if I only install one SDK or both windows 10 and 11 sdk
I'm not sure about this, I think it shouldnt matter.
thanks bro
I followed your steps but i got 2 errors. How to fix
Error LNK2001 unresolved external symbol _main
Error LNK1120 1 unresolved externals
Can you send the whole project folder (with the solution file) to our telegram group
t.me/wearesciber/1
@@wearesciber thanks for your prompt response , I already fix the problem.
Thats great. Can you tell us the problem
@@wearesciber i forgot to input this "}"
@@wearesciber can you make a video how to calculate the area of a circle? I search here in YT but they are not use the same as mine. VS2019
Thankyou👍👍👍👍👍👍👍🙏🙏
Even with all prerequisites installed, there is no search result for "CLR"
interesting, I just installed it today on another computer.
Perhaps search for cli v143 in the individual components section in visual studio installer and check if that's installed.
@@wearesciber is there I way I could send you images?
send them via facebook or telegram: sciber.dev/fb or sciber.dev/tg
Hello bro! when i run my code (form application with C++) The console(black screen) is appear with my form , How can I prevent it from appearing ??
I think you haven't made changes to the project properties as I showed in the video. You need to change the System->Subsystem to Windows. If this doesn't work, let me know.
@@wearesciber thank you so much, you are the best
You are welcome 😋
It's a great video! 👍 But i have another problem with the .exe file. I get an error that it cannot find 'Project.1.exe'. Anyone had a similar problem??
Hi can you send some screenshots of the Error message to our Telegram Group: t.me/wearesciber_chat
Is the equivalent code generated after adding the button?
I'm sorry, could you clarify a bit
@@wearesciber i mean to ask, for example we added a button from the shown drag and drop method, then is the equivalent c++ code generated or not? The code then coul be used to manipulate the properties of button such as it's size and position,
Yes it is generated. If you go to MyForm.h code, it is there.
@@wearesciber Thankyou so much for this solution and for creating Winforms tutorial playlist. 🫡🫡
how to hide console?
Project properties->system->subsystem->windows