Forumite Members › General Topics › Tech › Makers & Builders › Programming/Code tips › C++ Programming
- This topic has 258 replies, 5 voices, and was last updated 2 years, 12 months ago by
Wheels-Of-Fire.
-
AuthorPosts
-
December 12, 2020 at 6:15 pm #64553
Well my link seems to work but the direct link to the book site is now broken ! If you would still like a look then just go to http://www.stroustrup.com and find it from there.
To make my program display the image you have to download both files to the same folder and run the .EXE from there.
Ignore any warnings, I promise I am not trying to infect your PC :bye:
December 12, 2020 at 6:53 pm #64557Hmm. Apparently the jpeg didn’t share if your not me ! Try this:
https://1drv.ms/u/s!ApY7Ke0brhrm9H7DY2Sv1_R5HJpp?e=Ee6yK8
December 13, 2020 at 8:18 am #64567Very nice, if you like fiddling with supported M$ graphics try WPF 3D. Although it will do animation quite nicely it is not a game engine, but rather a system for including graphics within a program e.g. 3D representations of data etc. There is a tutorial with examples here.
Personally I used to prefer to use shaders while playing with graphics – but this has become quite a specialist area now that nVidia and the like have got loose on it and the Unified Shader Model has left me a long way behind and back in the days of OpenGL shaders. Hell, even the kids are now writing better Minecraft Shaders than me!
December 13, 2020 at 10:19 am #64569Thanks for the link Ed. I am aware of WPF and I will be looking at it in future but it uses XAML and is based on the .NET framework which would really require me to use a managed language like C#. Although it is possible to include managed code modules in a native C++ project I am nowhere near competent enough to do that yet :scratch:
I came back to the Programming Principles And Practice book because it uses example graphics classes to demonstrate class inheritance. I am currently stuck in a mire of base classes, templates, virtual functions and pure virtual functions with my other programming book so I was looking for other examples.
I was not previously able to work through the example code because it would not compile due to the faulty “std_lib_facilities.h” file, but now I can.
I was going to include a link to the source code for my FLTK Window program but it is part of a project that includes the compiled FLTK code and the Graphics class headers from the book. I cannot see a way to export a project so that it will compile from any location, the path names stay fixed so a copied project cannot find them. Any ideas ?
December 13, 2020 at 11:29 am #64571XAML does NOT require you to use C#, but as it is geared towards app production it does require managed code to use a bindable XAML when compiling the exe. Search on XAML and C++ if you ever want to use it.
December 13, 2020 at 2:39 pm #64574Oh yes, C++/WinRT.
C++/WinRT is an ISO compliant, header based, library for C++17 and above, it replaces C++/CX which was a non compliant language extension for C++11.
If I start a UWP C++ project in Visual Studio then the C++/WinRT library gets included and it also provides an XAML editor for good measure. Or so the doc’s say, haven’t actually tried it yet :rose:
The resulting compiled code still relies on the Windows runtime so it only works on W8 and above.
December 13, 2020 at 5:57 pm #64576C++/WinRT sample project nearly in action (The cube spins when the program is running).
December 13, 2020 at 7:05 pm #64578Well done! Very pretty. :yahoo:
December 14, 2020 at 2:14 am #64587I am not claiming the credit for that, it is the VS sample project with only “and Graham” added by me 😁.
I wanted to post a link to the compiled program so you could see it running, but even the release build doesn’t produce stand alone code so it only runs from inside Visual Studio.
It seems I must produce a UWP package but the package builder insists I supply a certificate (I think I can get a temporary MS signed one) and a URI (Yes not URL) for a hosting site that will provide updates (haven’t a clue).
If I try to run the program from outside of VS then it comes up with 5 or 6 missing DLL’s that I assume are generated by the package manager when I select a target platform.
In any case I would end up with a program that has to be installed before it can be run.
December 14, 2020 at 7:24 am #64590It used to be possible to create a self-signed certificate for test purposes using something like Method 2 in the following link. I’ve not had cause to use this for years (too much playing with coding on a Raspberry Pi), so I’m not sure if it still works. :scratch:
December 14, 2020 at 12:52 pm #64596I have a package !
Turns out I missed a tick box that said “Provide update server”, once I unticked that, on a previous page, I was able to continue with creating a self signed certificate and building the package.
I will provide a link in my next post but I’m not sure you will be able to install it because the cert will not be immediatly trusted on your machine.
December 14, 2020 at 1:50 pm #64599https://1drv.ms/u/s!ApY7Ke0brhrm9QJ30i7O4IlSpZqz?e=PdPegt
If you wish to try installing my program then the folder from the above link needs to be downloaded first, then click through to App2/AppPackages/App2/App2 1.0.0.0_Test and find Add-AppDevPackages.psi, right click on that and choose Run with Powershell. This is where the cert problem will probably crop up. I would be interested to know what happens because I haven’t got another Windows machine handy to test it with :wacko:
December 14, 2020 at 4:30 pm #64604It depends on the recipient’s AV security levels, most will barf at self signed security packages that are on a different machine. These are normally only used on the developing machine or within the developer’s domain.
December 14, 2020 at 8:04 pm #64607I have now had a chance to test the installation process on another machine and it works fine with a few cravats.
The machine I tested on only has Windows Defender as it’s antivirus and it wasn’t bothered in the slightest. I get the same response on my machine but Avast brings up a warning and insists on doing a scan.
The PowerShell installation script is very well written and it doesn’t fail when it encounters an error, it asks if you would like it to make changes to your system instead.
The first error says you need to run PowerShell in admin mode to make the required changes to your system. When you hit enter an elevation box pops up and when you hit accept the script continues.
The next error is about cert signing and it asks if you would like to make changes to your system to allow the installation of this program or all programs from this author.
If you answer yes then you get the third error which says your system needs to be in developer mode to make the required changes. When you hit enter the control panel box for setting developer mode pops up so you can enable it.
Now with any luck the installation continues to”Sccess!” and the program appears in your installed apps list along with its Uninstall button.
Simple see :scratch:
December 15, 2020 at 9:34 pm #64633Here is a copy of my security certificate, issued to Me, by Me 😉
December 17, 2020 at 1:42 pm #64700Ont of interest, the Visual Studio Visual XAML editor is Blend (not to be confused with Blender but it can do 3D objects and animations.
Blend is a big upgrade over the Forms editor that was previously used with .NET languages and it loads by default when I start a C++/WinRT project.
Blend opens in a split screen mode where the top half is a canvas where you can drag and drop objects and the bottom half shows the XAML code for the page.
If you add or change objects on the canvas then it changes the code and vise versa.
December 22, 2020 at 7:09 pm #64829At last, by special request, without further ado, I bring you :
The Visual Studio C++ Manual !!!
https://1drv.ms/b/s!ApY7Ke0brhrmgP8N77z7PjfE6NoINg?e=zpeYGj
Please download it before its gone 🙂
December 23, 2020 at 10:38 pm #64875Yay. I have finally got github properly setup and integrated with Visual Studio, only took 3 hours !
I can now clone a copy of any publicly avaliable repository to a local folder on MY machine, it doesn’t matter if they thought to include a master zip or not.
The first thing I did was to clone a copy of the Visual Studio package manager (vspkg) package and get it properly installed and integrated into VS, I only had the package builder part previously.
Now I can get and run all the VS demo packages (the bullet physics demo looks good) along with all the VS extensions written by MS and others, should I wish 🙂
December 25, 2020 at 9:04 pm #64923I have somehow managed to install CMAKE support in my Visual Studio GUI. Now when I hit File>Open I get the option to open a CMAKE file and if I do it only imports the files listed in there, instead of all the files in the current directory. Don’t know what I did but I wish I had done it before I went through putting all the project code from my C++ Primer book into separate folders :wacko:
January 2, 2021 at 10:21 pm #65148Ooh, I have been promoted to Editor status on Stack Overflow.
Maybe NOW people on there will stop criticising my writing style and read the content.
Nah, never happen 🤣
-
AuthorPosts
- You must be logged in to reply to this topic.
