all i want to do is run a C++ example - Page 1
Forum section: electronics / general

author: Simon
author_rank: Unknown
timestamp: February 06, 2023, 10:34:47 pm
content: I am so pissed off. I am trying to learn C++, -step one, copy the first example code that is about 1 sentence long into visual studio code, 2 discover that visual studio code with C++ tools installed does not have a C++ compiler, 3 go around and around in fucking circles trying to find out how to install C++ in visual studio and got no where except being told to download visual studio - what is the difference?. Seriously ? do coders just take the fucking piss all the time???How can it be so hard to just install an IDE with compiler??? and my junior colleague thinks I am a jkbit weird for preferring bare metal programming.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 06, 2023, 10:45:08 pm
content: So... install plain ol' Studio?VSC is a different beast, AFAIK.An IDE is for editing and issuing commands, it's not necessarily the commands themselves. Code::Blocks is another IDE without compiler; but it has presets for the major ones so it's very easy to drop one in.Tim

author: Simon
author_rank: Unknown
timestamp: February 06, 2023, 10:47:57 pm
content: that's the problem. I can't "drop" a compiler in. what is the difference between VSC and VS? anythings else that makes sence? I take it codeblock is not that horrible thing microchip use for MPLABX?All i want to do is run:Code:#include "std_lib_facilities.h"int main() // C++ programs start by executing the function main{cout << "Hello, World!\n"; // output “Hello, World!”keep_window_open(); // wait for a character to be enteredreturn 0;}I have spent the evening getting no where.

author: Simon
author_rank: Unknown
timestamp: February 06, 2023, 10:51:07 pm
content: how quaint, the C++ install is just a mere 14GB

author: IanB
author_rank: Super Contributor
timestamp: February 06, 2023, 10:52:01 pm
content: https://code.visualstudio.com/docs/languages/cpp

author: Simon
author_rank: Unknown
timestamp: February 06, 2023, 11:05:20 pm
content: Quote from: IanB on February 06, 2023, 10:52:01 pmYes that particular page is useless and I can't work out if they are talking about VS or VSC, it's a joke!

author: brucehoult
author_rank: Super Contributor
timestamp: February 06, 2023, 11:08:31 pm
content: Quote from: Simon on February 06, 2023, 10:34:47 pmVisual Studio Code is just an editor, not an IDE.If you want an IDE, with compilers and stuff, install Visual Studio.Or just use the built in command line tools on Mac or Linux rather than torturing yourself with Microsoft stuff. If you type "c++" on either one and it's not installed then it will tell you how to install it / offer to install it.

author: shapirus
author_rank: Super Contributor
timestamp: February 06, 2023, 11:24:31 pm
content: Quote from: Simon on February 06, 2023, 10:34:47 pm1. you don't want an IDE unless you know precisely why you want it for a particular task. using an IDE is a separate skill in itself. it needs its own learning course which wastes precious time, especially when you're a beginner. first learn to write programs, then learn to use an IDE, one of many, if you need it.2. windows is not a programmer-friendly OS and is even less suitable for education, because it requires you to deal with a lot of stuff you don't immediately need. this is why and where many bail out and give up on learning to code right at the beginning.see how easy it is to do what you want on linux:1. copy&paste your code to a text file (normally done with a text editor, using cat here just for demonstration):Code:$ cat > example.cxx#include <iostream>int main() // C++ programs start by executing the function main{std::cout << "Hello, World!\n"; // output “Hello, World!”return 0;}2. compile (and, strictly speaking, link in the same step)Code:$ g++ example.cxx -o example3. run!Code:$ ./exampleHello, World!doesn't require to install and configure a shitload of bloatware. doesn't require any mouse fiddling. doesn't get any easier and more efficient than this.

author: brucehoult
author_rank: Super Contributor
timestamp: February 06, 2023, 11:51:02 pm
content: You forgot "apt install g++" :-) Or yum or whatever your non-Debian based distro uses. But use Debian-based (Ubuntu etc) if you want an easy life. That includes people saddled with Windows, if they install WSL.But I agree with you. IDEs are for when you're dealing with some massive, hundreds of thousands of lines, corporate monstrosity of a code base. If then. Absolutely not needed and really just gets in the way for anything you write yourself.

author: IanB
author_rank: Super Contributor
timestamp: February 06, 2023, 11:51:49 pm
content: Quote from: Simon on February 06, 2023, 11:05:20 pmVisual Studio Code is a tool for experienced programmers, it is not really aimed at learners.If you want a simple way to get started, you should look here instead:https://visualstudio.microsoft.com/vs/community/There are of course other options, but I can tell you for certain that Visual Studio Community edition is simple, straightforward and has all the features you need.

author: IanB
author_rank: Super Contributor
timestamp: February 06, 2023, 11:55:44 pm
content: Quote from: brucehoult on February 06, 2023, 11:51:02 pmExcept as soon as you want to do something nontrivial, you will need to learn about makefiles, and then perhaps compiler options, and after that probably git, and before you know it you will be deep in the mire.Anyone who tells you that programming is simple is being economical with the truth.

author: shapirus
author_rank: Super Contributor
timestamp: February 07, 2023, 12:03:36 am
content: Quote from: brucehoult on February 06, 2023, 11:51:02 pmCorrect. That would make a tiny bit of a homework to google for the error message in case g++ is not installed. Even that will not be required in a standard Ubuntu installation that has the "command-not-found" package installed by default which makes your shell suggest packages that contain the command that wasn't found but can be installed.Quote from: brucehoult on February 06, 2023, 11:51:02 pmThat's correct. But using a real Linux installation is just so much better, if you have a choice (i.e., are not restricted by corporate policies and do not need to run some windows-specific software that fails to run under Wine).Needless to say that all of this is my personal opinion, yet it's based on a good 25 years of experience.

author: brucehoult
author_rank: Super Contributor
timestamp: February 07, 2023, 12:09:13 am
content: Quote from: IanB on February 06, 2023, 11:55:44 pmYou can get a long way with a single source file.And gccfoo.c bar.c baz.c qux.c -o foowill get you a lot further.At some point, yeah, you could put that in a simple shell script, or a makefile. But that might be weeks or months in the future. I'd get started with git a lot sooner than that. Like 2nd day.But the thing about it is you can learn things gradually as you need them, not everything all at once before you can run your first program.

author: shapirus
author_rank: Super Contributor
timestamp: February 07, 2023, 12:19:20 am
content: Quote from: IanB on February 06, 2023, 11:55:44 pmMakefiles are actually next to trivial and very easy to learn. More complex build systems such as autoconf, cmake, etc. are more difficult, but they are not required until the project gets big and/or aims to be cross-platform compatible and become public.Compiler options are learned and added as you need them. Defaults are fine, except that it is a good idea to use "-Wall -pedantic" right from the start.Git will eventually become required no matter what ecosystem you choose, except when you opt for that Microsoft-made makeshift nonsense forced upon the unlucky ones (used to be called VSS, no idea how it's called now) that they created only to reinvent the wheel and avoid following one of the industry-standard solutions. And even then you still need to know a necessary minimum of Git.But it's not required for a beginner playing around and making first steps on her/his local machine.The good thing about the Linux ecosystem, or the Unix-style approach to programming and controlling the machine in general, is that you learn and begin to deal with each new entity only as it becomes needed. Step by step, simple to complex, perfect for learning.Quote from: IanB on February 06, 2023, 11:55:44 pmCouldn't be said better.Yes, programming IS simple. You just tell the machine what it has to do, can it be any simpler?But there are certain nuances, which the beginner doesn't need to know right away -- that's what you called being economical with the truth.

author: rfclown
author_rank: Frequent Contributor
timestamp: February 07, 2023, 03:59:48 am
content: I don't do C++, but I do C on the command line. Just use a text editor. I googled and followed instructions years ago for installing CodeBlocks for use with with command line. I see in my install folder that the file was codeblocks-17.12mingw-setup.exe. I don't use the IDE (maybe it's great, I don't know). I have a batch file called c.bat which is:gcc %1.c -o %1.exeso all I type to compile foo.c is "c foo". Yes, if I have to link other libraries and stuff, there's more to it, but for just getting going that's all you need.I just tried to see if C++ worked also (I didn't explicitly install C++). I first tried your example, and it barfed on finding std_lib_facilites.h. Then I tried shapirus example, and it compiled fine. I typed:g++ foo.c -o fooand when running foo.exe got:Hello, World!

author: brucehoult
author_rank: Super Contributor
timestamp: February 07, 2023, 04:13:16 am
content: Quote from: rfclown on February 07, 2023, 03:59:48 amGoogling says that's from a book by Stroustrup and you need to download it from his site:https://www.stroustrup.com/Programming/std_lib_facilities.h

author: JPortici
author_rank: Super Contributor
timestamp: February 07, 2023, 06:43:14 am
content: Quote from: Simon on February 06, 2023, 10:47:57 pmthat would be Netbeans. Much less horrible than eclipse IMHO, too bad it lost traction to eclipse.If it's very simple code, and don't need an executable and/or don't want to bother creating a project i usually go herehttps://www.onlinegdb.com/online_c_compiler(change the language to whatever suitable for your need)Otherwise, because i have Qt already installed i create a Qt console Project. I can remove everything from Qt if i want to.Another option is that you install by yourself MinGW (Use. The. Installer. Don't. Do. It. Manually.), with the installation manager it's a breeze, then you have GCC at the command line, can add GCC to VSCode (if you really want it, i don't understand those who diss netbeans or eclipse then praise VSCode, Everything seems a hack put together with spit and mud)For a time i dabbled with Visual C++, but Visual studio, besides being a giant behemoth, has so many features i don't use, and i don't plan to ever use WPF or WinForms again, so it would be another giant IDE with its giant compiler taking up space. Qt takes enough space by its own

author: Ian.M
author_rank: Super Contributor
timestamp: February 07, 2023, 09:19:05 am
content: So its 13 months later and you haven't made any significant progress! Take another look at your topic:https://www.eevblog.com/forum/programming/general-ide-to-learn-c-on/We suggested several combinations of IDE and (usually) GCC based compilers which would give you less hassle and significantly smaller download size than anything recent from Microsoft. and discussed how to install them. I even posted a zipped project of the "Hello World" program from chapter two of your book, that will work if you use the Bloodshed/Orwell/Embarcardo forks of the Dev-C++ IDE (or with any GCC based compiler from the command line).

author: Simon
author_rank: Unknown
timestamp: February 07, 2023, 09:19:35 am
content: I write programs just fine for micro controllers in microchip studio, now I just want to run the examples and exercises in a book to learn C++ that I will use on a micro controller in microchip studio the whole universe blows up

author: Simon
author_rank: Unknown
timestamp: February 07, 2023, 09:22:24 am
content: Quote from: Ian.M on February 07, 2023, 09:19:05 amCorrect, thought I was going round in the same circle again. I'm also not that interested in the IDE, but the discussion if I recall descended into which IDE is better and I just got lost. I just need to do the stuff in the book, at the end of the day I don't seem to have a choice of IDE , as everyone here points out they are hard work, so I'll be using whatever the micro controller manufacturer provides.

author: Ian.M
author_rank: Super Contributor
timestamp: February 07, 2023, 09:25:03 am
content: Quote from: Simon on February 07, 2023, 09:19:35 amThat's windows PCs for you - they've been a PITA to program on & for in C (or later C++) for the last 30 years. You may notice a great theme throughout your old topic - the majority of us are pointing you at one 'flavour' or another ofGCCrather than any Microsoft compiler!

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: February 07, 2023, 09:30:36 am
content: Quote from: Simon on February 07, 2023, 09:22:24 amIt's the debugging features that really make a IDE worthwhile. But at the end of the day, do what makes you happy.

author: Ian.M
author_rank: Super Contributor
timestamp: February 07, 2023, 10:00:10 am
content: Quote from: Simon on February 07, 2023, 09:22:24 amSo grab theEmbarcardo fork of Dev-C++which comes with a reasonably current GCC compiler, and grab the book-specific header file "std_lib_facilities.h" Brucehoult linked above, and have at it with the chapter two "hello World" example. It should 'just work' - as it did for me 13 months ago.Note that the zipped project (of this example) I posted back inreply #53of your old topic is set up for the TDM-GCC 10.3.0 toolchain(which I posted installation instructions for back inreply #33)so if you choose to use that project with Embarcardo Dev-C++'s bundled Mingw GCC, you'd need to reselect the project toolchain.

author: Brianf
author_rank: Regular Contributor
timestamp: February 07, 2023, 02:11:37 pm
content: Why install anything?https://godbolt.org/

author: Siwastaja
author_rank: Super Contributor
timestamp: February 07, 2023, 03:09:51 pm
content: You got many good suggestions over a year ago:https://www.eevblog.com/forum/programming/general-ide-to-learn-c-on/You were also explained what VS Code is.So it appears you ignored all the advice and now you are again pissed off, and probably unwilling to learn, again? What's different this time?My advice is unchanged:https://www.eevblog.com/forum/programming/general-ide-to-learn-c-on/msg3903872/#msg3903872

author: IanB
author_rank: Super Contributor
timestamp: February 07, 2023, 03:11:58 pm
content: Quote from: Simon on February 07, 2023, 09:22:24 amBloody hell, they are not hard work!If you are on Windows, just install the free Visual Studio Community edition from Microsoft, choose the C++ option when you install it, and a few minutes later you will be up and running.There a bunch of people here who say to avoid Microsoft, and if you were on Linux or Mac they may have a point. But if you are on Windows, avoiding Microsoft is only going to make things difficult. So don't. Go with the flow, choose the easy path, and concentrate on programming.And forget the bullshit about it being big and bloated and overkill. If you were on an ancient PC with 1 GB of memory with a Celeron processor and a slow disk, then maybe it would be slow. But on a modern PC that's irrelevant. I have the lowest power desktop imaginable and Visual Studio opens in two seconds.

author: shapirus
author_rank: Super Contributor
timestamp: February 07, 2023, 03:16:31 pm
content: Another point: there is a possibility that you don't need C++. Don't try to lift more weight than you need. Start with plain C.

author: Simon
author_rank: Unknown
timestamp: February 07, 2023, 05:18:23 pm
content: Quote from: shapirus on February 07, 2023, 03:16:31 pmOver my time of learning C which I did on micro controllers I have often come here with questions about code styling and solutions to reusable code. The answer was often, there is nothing wrong with doing that but it won't work in C, C++ does exactly what you want and will make it easier.Well I won't really know until I try it, so I am prepared to spend some time learning C++ following the book, I don't know how complex the examples will get and if I need an IDE or if the online stuff will be good enough.I never thought it would be this hard. Yes i did try listening over a year ago, I did try stuff and I just gave up as I did not have time to make the whole IDE thing work. Now I try again I still find it is so ridiculous that I have in trying to download a C++ compiler run into a scam website and in trying to download GCC I have gone around and around in circles ending in directory views of a bunch of files on some server and no clue which I am to download.I'm obviously "not in the circle"

author: IanB
author_rank: Super Contributor
timestamp: February 07, 2023, 05:27:27 pm
content: Quote from: Simon on February 07, 2023, 05:18:23 pmThis is because you are listening to crazy people giving you crazy advice.Just go to this page,https://visualstudio.microsoft.com/vs/community/click the Download button, choose C++, and a few minutes later you will be up and running.Isn't this exactly what you do with Microchip Studio?Don't make things more difficult than they need to be.

author: shapirus
author_rank: Super Contributor
timestamp: February 07, 2023, 05:30:16 pm
content: Quote from: Simon on February 07, 2023, 05:18:23 pmthis is what you don't need to do in its native ecosystem. "apt-get install gcc g++" is a single command that will take care of downloading and installing it the right way.but even under windows, if you useWSL, it's going to be just as simple, as far as I understand (never personally used it though -- I use native linux).

author: Ian.M
author_rank: Super Contributor
timestamp: February 07, 2023, 05:34:11 pm
content: Unless the objective of this topic is purely for you to vent, it would help to state what you've tried (e.g. how you ended up at the possible 'scam website'), and which GCC download pages confused you so much.Alternatively bite the bullet, give up any illusion of privacy and 'drink the Microsoft kool_aid'. You will (most likely) get a working (for now) C++ development environment, along with a whole lot of other stuff many of us would pay good money to avoid!

author: IanB
author_rank: Super Contributor
timestamp: February 07, 2023, 05:35:24 pm
content: Quote from: shapirus on February 07, 2023, 05:30:16 pmBut Simon is not on Linux, so talking about Linux is just a waste of time.And WSL is not an answer. It is just one more piece of technical complexity that Simon doesn't need.

author: Ian.M
author_rank: Super Contributor
timestamp: February 07, 2023, 05:43:35 pm
content: Yes, there is no need for WSL, as there are several Windows ports of the GCC compilers, and very few of the IDEs mentioned are Linux only.

author: shapirus
author_rank: Super Contributor
timestamp: February 07, 2023, 05:44:41 pm
content: Quote from: IanB on February 07, 2023, 05:35:24 pmit's up to him to choose between using a right tool for the job and trying to draw a nail with a silicone dildo. (of course, which of the proposed solutions is meant by each of these analogies depends on everyone's personal views.)both solutions have been described and advocated for sufficiently by this point for an adult human to make his choice.

author: SiliconWizard
author_rank: Super Contributor
timestamp: February 07, 2023, 08:10:49 pm
content: Not meaning to be harsh, but if one cannot even manage to find, install and use basic tools for compiling a couple lines of C++, not sure what will come out of all this.

author: Simon
author_rank: Unknown
timestamp: February 07, 2023, 08:30:28 pm
content: Quote from: SiliconWizard on February 07, 2023, 08:10:49 pmI dunno, not that I am a genius with programming but I can get done what I want to in an IDE with C for embedded. I have in fact asked in the past so will refrain from doing so again how I would set up an IDE to work with a particular target, the answers were an argument about which IDE was better much like my old topic of 1 year ago and my actual question went unanswered.All I want to do is explore a new language, Like when I want to read a different book, I don't need to print and bind the book myself.My dilemma is the same as when I started with C, every book just talks about the language, makes an IDE sound like a simple tool that you "just" use and tells you how to write programs that will only work on a PC as they always involve keyboard input and display output, the very two things that a micro controller does not "just" have. After a lot of head banging I managed to figure out the manufacturers own IDE, learn some C and how the micro controller worked and slowly got there. I could not do a sodding damn thing on a PC with C and neither do I want to. I now start all this again just to have a little look at C++ just to see if it is worth it. Back in the day I did in fact do the C examples in a windows IDE, how cool was that!!!Is that a simple enough explanation?As for me making hard work of it, what seems to be the official wiki of codeblocks contains dead links and links to sites that have since changed, not to mention one that tried to scam me into a subscription for mcfee!!!

author: IanB
author_rank: Super Contributor
timestamp: February 07, 2023, 09:21:30 pm
content: Quote from: Simon on February 07, 2023, 08:30:28 pmBut WTF are you trying to use Code::Blocks when it is not a C++ compiler?You seem to spend time constructing an elaborate apparatus for shooting yourself in the foot, and then being upset when you succeed in doing so?

author: Simon
author_rank: Unknown
timestamp: February 07, 2023, 09:31:50 pm
content: I need some sort of IDE? or shall I do it all in DOS like the 80's?Maybe I just start looking at some random tutorials on the web, stuff this old bloke and his book and I just throw it onto an ARM core with microchip studio like I did with C. Will take 10 times longer maybe but looks like my next step is to actually move to linux which I would love to do but that means I have even more stupid situations with "problems" than I am here with my main OS

author: nigelwright7557
author_rank: Frequent Contributor
timestamp: February 07, 2023, 09:35:11 pm
content: Visual Studio comes with an installer where now you add in what compilers you want to use.Run VS installer and tick the C++ box and you are ready to go.

author: IanB
author_rank: Super Contributor
timestamp: February 07, 2023, 09:45:10 pm
content: Quote from: Simon on February 07, 2023, 09:31:50 pmAre you trolling, maybe? You have been told about Visual Studio many times and you don't even respond or acknowledge it.

author: langwadt
author_rank: Super Contributor
timestamp: February 07, 2023, 09:46:00 pm
content: I had to try. visual studio community on google, hit first Microsoft link, download and run installer, select c++, wait for 2.4GB download, run visual studio, select new project from template, C++ console program (default hello world), ctrl-F5 to build and debug (it says so in the comments), and it prints "hello world"probably less than a minute excluded waiting for the download ...

author: shapirus
author_rank: Super Contributor
timestamp: February 07, 2023, 09:51:31 pm
content: Quote from: langwadt on February 07, 2023, 09:46:00 pmWell done.I have to retract my recommendation for Linux. It won't help.

author: nigelwright7557
author_rank: Frequent Contributor
timestamp: February 07, 2023, 10:01:16 pm
content: Quote from: shapirus on February 07, 2023, 03:16:31 pmThat's a good point, quite a few microcontrollers IDE's just use C.

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: February 07, 2023, 10:14:18 pm
content: Quote from: Simon on February 07, 2023, 08:30:28 pmThe world has changed. The new cool is to remote into numerous boards from your favourite DE, and that, essentially, is the keyboard in/display out, during development.And much, much more. If you can setup GDB, you get a rich devel env that some of us could only dream about once upon a time.

author: IanB
author_rank: Super Contributor
timestamp: February 07, 2023, 10:19:29 pm
content: Quote from: Ed.Kloonk on February 07, 2023, 10:14:18 pmI have not done embedded work, but I would imagine you also get an emulator to check things out on the desktop before going to the real hardware?

author: shapirus
author_rank: Super Contributor
timestamp: February 07, 2023, 10:24:10 pm
content: Quote from: nigelwright7557 on February 07, 2023, 10:01:16 pmYes, but it's not the reason I implied. To write code for microcontrollers it's possible to use any language for which there is a compiler producing native machine code or a way to execute interpreted code: in this regard C and C++ are equal.C++ is a great language, but does one *really* need all of its bells and whistles? In case C is thought inappropriate from the perspective of making simple things look difficult (yes, it's actually true, to a certain extent), then C++ won't make much of a difference from this point of view, and a higher level language would probably be more suitable and easier to grasp.Of course if the goal is to learn C++, then the suggestion to use any other language makes no sense. I'm not sure whether it's the case though (the case still remains a bit unclear to me).update: after re-reading some posts, I finally understand that the goal is exactly what is stated in the thread title, *but* at the same time following what is written in a book. In this case, there's no other way than to follow the book and go through the pain of installing the required IDE and everything.

author: Simon
author_rank: Unknown
timestamp: February 07, 2023, 10:30:11 pm
content: Quote from: IanB on February 07, 2023, 10:19:29 pmNo you compile and load and the debugger controls the program so that you can halt and check stuff. I have not done that personally, the only time I tried it was clear that i needed to learn to do it properly as it was not intuitive and the IDE's instructions were as good as "hey guys, you have a debugger" and that was it. again, no idea where I learn about this as the tutorial video spent more time showing me how to set up the dev board than actually debug but I am slowly learning to accept that this is how it is.I could try visual studio now that I have it, as for not listening I have had a half dozen recommendations and not actually wasted a day on this so have not had time to get through them. The online thing failed, codeblocks seems a waste of time, GNU GCC go use linux as for VS no it is not 2.4GB is is 14GB!!! or did I pick a different option that was equally obviously "the C++ thing" ?

author: IanB
author_rank: Super Contributor
timestamp: February 07, 2023, 10:31:40 pm
content: Quote from: shapirus on February 07, 2023, 10:24:10 pmYou don't need all of the features (or even most of them), but some features like concrete classes, constructors, function overloading, even basic templates, can be very helpful.

author: IanB
author_rank: Super Contributor
timestamp: February 07, 2023, 10:34:02 pm
content: Quote from: Simon on February 07, 2023, 10:30:11 pmBe aware that you talked about VS Code which isNOTVisual Studio. You do not want Code, you want Visual Studio. Follow the links above, or Google for "Visual Studio Community Edition".

author: shapirus
author_rank: Super Contributor
timestamp: February 07, 2023, 10:35:55 pm
content: Quote from: IanB on February 07, 2023, 10:31:40 pmSure they can. As well as in nearly any modern OO language. The question was more like whether this is required for a specific task, but since the task is to run a C++ example, obviously it can't be done in any other language than C++.

author: Simon
author_rank: Unknown
timestamp: February 07, 2023, 10:36:19 pm
content: Quote from: shapirus on February 07, 2023, 10:24:10 pmMicrochip studio which actually is just VS with atmel/microchip setup uses the GCC compiler for ARM and will take C and C++, even when adding just a C file you are actually adding a C/C++ file as it does not distinguish, the compiler is C++ and as such that I understand it will also compile C.As I said further back in my attempts to make code as reusable as possible and flexible I have often come asking questions about what I can do. The answers have often been that in C you can't do that but essentially what I am asking to do is what C++ does. i have also noticed that a lot of ARM libraries are available as C++ only. So at least looking at C++ sounds like a good idea.Oh, and yes I did try VS, still failed.

author: Psi
author_rank: Super Contributor
timestamp: February 07, 2023, 10:38:39 pm
content: I've not read this entire thread,but if you;- Just want something quick to install to play around with C++ making windows or command line apps.- Want something that has everything you need in one install, and will work out of the boxThen you could download the "Embarcadero C++ Builder Community Edition."It's basically the free/starter edition using the IDE that Delphi uses but with full C++ compiler.(The company that makes Delphi have both C++ and Pascal(delphi) versions)https://www.embarcadero.com/products/cbuilder/starter

author: Simon
author_rank: Unknown
timestamp: February 07, 2023, 10:39:43 pm
content: Quote from: shapirus on February 07, 2023, 10:35:55 pmThe task I have set myself is to explore C++, as a starter for 10 and without wondering if I am at fault or something else is wrong, running an example is the place to start, or am I wrong?

author: Simon
author_rank: Unknown
timestamp: February 07, 2023, 10:40:21 pm
content: Quote from: Psi on February 07, 2023, 10:38:39 pmi will try, but several people have said the same thing about different things.

author: Psi
author_rank: Super Contributor
timestamp: February 07, 2023, 10:42:05 pm
content: Quote from: Simon on February 07, 2023, 10:39:43 pmEmbarcadero C++ Builder Community Edition will do that just fine. and it's graphical IDE, you can drag buttons/components onto the main application form and add C++ code for onclick event etc.. And of course you can get complex and create your own classes/objects etc..

author: shapirus
author_rank: Super Contributor
timestamp: February 07, 2023, 10:44:25 pm
content: Quote from: Simon on February 07, 2023, 10:39:43 pmThat's perfectly fine, only there seem to be some difficulty in getting started with a particular IDE or something. I suggested one way of trying it (sure it's not for everybody) that bypasses the IDE whatsoever; if it doesn't work, then there's a windows-native way, for example described step by step in post #40. I didn't try it, but it looks quite straightforward to me. What is it exactly of the steps listed there that fails for you?

author: IanB
author_rank: Super Contributor
timestamp: February 07, 2023, 10:48:02 pm
content: Quote from: Simon on February 07, 2023, 10:36:19 pmPlease tell us you did what langwadt did in reply #40, and if it failed, what went wrong?And as a reminder, what you described at the top of this thread was not Visual Studio.

author: Psi
author_rank: Super Contributor
timestamp: February 07, 2023, 10:48:50 pm
content: Different people learn in different ways.Some people just want something easy to get started with, doesn't matter what it is, just needs to be effortless to get started.It's very annoying when you make the decision to learn something and there is a big wall to overcome in order to even create "hello world".

author: Sherlock Holmes
author_rank: Frequent Contributor
timestamp: February 08, 2023, 03:55:16 am
content: Install Visual Studio (community edition or a paid subscription) edition. Now, to work on microcontrollers, go and get VisualGDB, it is absolutely superb quality, these guys know their subject.VisualGDB will install EVERYTHING needed, I had code running on an STM32 board within 15 minutes after installing VisualGDB, let me know how it goes, I've used Visual Studio for C development for over thirty years, so I'm sure I can help you.Microsoft use Visual Studio and their C and C++ compilers to maintain Windows, kernel mode device drivers and Visual Studio itself. I too hate the stupid name "Visual Studio Code", it's about as unhelpful as a name could be.Finally, are you sure you want to learn C++? why? unless you have to, I wouldn't waste the time, there are far better languages to spend your time on, seriously.

author: Simon
author_rank: Unknown
timestamp: February 08, 2023, 09:04:52 am
content: I will have another look tonight. When i looked into doing things like running a file system on an SD card all I found were C++ libraries, so I reasoned I need to learn C++. In the same way I started learning C as that is what everyone else was using and all I could talk to them about, I had started out using BASIC on a PIC, worked for me, but I seemed rather alone.

author: Ian.M
author_rank: Super Contributor
timestamp: February 08, 2023, 09:21:27 am
content: I'm surprised you couldn't find a filesystem driver that doesn't need C++One of the most well-known reasonably lightweight ones suitable for lower resources embedded systems isElm Chan's FatFs, which is coded in ANSI C89, as historically many embedded cross-compilers have lagged behind mainstream C, and small embedded system C99 support was uncommon as recently as a decade ago.

author: nctnico
author_rank: Super Contributor
timestamp: February 08, 2023, 09:36:30 am
content: Quote from: Simon on February 08, 2023, 09:04:52 amStill, I'm wondering what other development tools you already have installed. If you already have an eclipse based IDE (like ST's Cube), then all you need to get going is to install the MingW64 compiler package. Some people don't like Eclipse but the fact is that most microcontroller IDEs are Eclipse based nowadays so using that keeps you close at home so to say. The nice thing about Eclipse is that you can always create other projects than the microcontroller specific ones so you can use ST's cube to also write applications that run on a PC. I'm doing that all the time to create test benches for code.

author: Kalvin
author_rank: Super Contributor
timestamp: February 08, 2023, 11:32:09 am
content: My 2c: Visual Code Studio + Platformio might be one alternative to get up & running. The development framework is available for both Windows & Linux, so you do not have to force yourself into Linux. There are plenty of tutorials and videos floating around (although not all are created equal in terms of quality). A huge number of processors, boards and frameworks are supported. Search engine and Youtube are your friends when getting started.

author: Kalvin
author_rank: Super Contributor
timestamp: February 08, 2023, 11:59:00 am
content: About learning C++: I would suggest that you start reading a book about C++ for beginners that uses Windows as the development environment, and start learning C++ by creating and running simple programs in PC using text-based terminal input & output. After you have gained some experience in PC environment, you should be able gradually start developing for the embedded systems.

author: Sherlock Holmes
author_rank: Frequent Contributor
timestamp: February 08, 2023, 03:32:10 pm
content: Quote from: Simon on February 08, 2023, 09:04:52 amId' agree with others here that if you really wany to get to grips with C++ then step back from MCUs for now. Learning C++ on Windows by writing code under Visual Studio is definitely a wise way to do that. Only once you're comfortable and have made most of the silly mistakes should you move to an MCU. Windows is a robust OS, even terribly buggy C++ will not impact the OS's stability so you can just rerun and retest over and over more easily than on an MCU where a freeze-up is the norm with buggy code.Frankly embracing C++ just because the first libraries you found were written in C++, isn't prudent, forget C++ if you can - IMHO anyway.

author: snarkysparky
author_rank: Frequent Contributor
timestamp: February 08, 2023, 08:31:05 pm
content: code blocks can be downloaded with compiler Download the Code::Blocks installer (https://codeblocks.org/downloads/26).If you know you don’t have MinGW installed, or if you don’t know which one tochoose, download the package which has MinGW bundled. For 20.03 version,the name of the installer is: codeblocks-20.03mingw-setup.exe. Previous version wasidentified by 17.12. Run the installer, it’s a standard installer for Windows; just press Next after readingeach screen. If you’re planning installing a compiler after you’ve installed Code::Blocks, read theinformation provided in the installer. If you downloaded the installer which doesn’t come with MinGW, you may have toconfigure the compiler manually (usually Code::Blocks’ auto detects the compiler).

author: eti
author_rank: Super Contributor
timestamp: February 09, 2023, 04:36:11 am
content: Quote from: Simon on February 06, 2023, 10:34:47 pmSimon, try nano and g++ - you can install them in a heartbeat if you install Linux on VirtualBox - never mind an IDE at this level. VS code can be a nightmare, yeah - I battled with it last year, but once you adjust it all falls into place.Yes, programmers assume WAY TOO MUCH - that’s why they hide away and don’t see sunlight, and that has the unfortunate effect of them not learning social skills, ergo are unable to adequately translate not necessarily THAT difficult subjects into plain talk for people like us to grasp. Sadly, a huge number of them have gigantic egos, and that’s not helped by the fact that they’re seen as some form of “superhero” type person - and they oft wouldn’t deign to lower themselves to try and imagine being in the position they were in BEFORE they knew what they now do, and then patiently and calmly explain it, making no assumptions of their pupils. Very few do this, which is why the REAL heroes are those who’s stand out by bothering to do so.It takes LOTS of effort and a natural, God-given gifting to be a clear, easy to follow teacher, and sadly the fact is that so many “tutorials” online are written/shot by people who vastly overestimate their natural talent for said technical teaching.

author: Psi
author_rank: Super Contributor
timestamp: February 09, 2023, 04:45:56 am
content: Quote from: eti on February 09, 2023, 04:36:11 amWhat a troll

author: eti
author_rank: Super Contributor
timestamp: February 09, 2023, 04:56:41 am
content: Quote from: Psi on February 09, 2023, 04:45:56 amHaving strong views != being “a troll”.Also can we please move on from idiotic, unimaginative internet phrases - we don’t call people with different views “trolls” in real life.The internet and it’s “traditions” and the inability of people to escape them, is hilariously tragic.Have some better words in your vocabulary!https://www.reddit.com/r/unpopularopinion/comments/84wcu9/people_need_to_stop_calling_everyone_who/Man up and grow up.

author: Psi
author_rank: Super Contributor
timestamp: February 09, 2023, 05:02:11 am
content: Wait, you are actually serious that he should use nano and a C++ compiler?The amount of time needed to set that up and learn about makefiles goes against the OP requirement of something simple and quick to get up and running. By like an order of magnitude.

author: brucehoult
author_rank: Super Contributor
timestamp: February 09, 2023, 05:05:18 am
content: Quote from: Psi on February 07, 2023, 10:48:50 pmWell, I agree!!!Here are complete instructions to make and run a C++ program on Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11:1) Open PowerShell or Windows Command Prompt in administrator mode by right-clicking and selecting "Run as administrator"2) type "wsl --install". This will take some time.3) type "bash".4) type "apt install g++". This will take less time.5) paste:Code:cat >hello.cpp <<END#include <stdio>int main(){std::cout << "Hello!\n"; return 0;}ENDg++ hello.cpp -o hello./helloHow freaking hard is that?

author: eti
author_rank: Super Contributor
timestamp: February 09, 2023, 05:06:13 am
content: Quote from: Psi on February 09, 2023, 05:02:11 amWhy didn’t you spend that energy constructively helping Simon instead of destructively telling me I’m “wrong”?Go and help him. If you don’t like my suggestion feel free too BUZZ ORFFF! 🐝

author: Psi
author_rank: Super Contributor
timestamp: February 09, 2023, 05:07:36 am
content: Quote from: eti on February 09, 2023, 05:06:13 amI did help him, i give him a simple way to install something that would work out of the box a few posts ago.

author: eti
author_rank: Super Contributor
timestamp: February 09, 2023, 05:09:57 am
content: Quote from: Psi on February 09, 2023, 05:07:36 amexcellent. Take care

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: February 09, 2023, 05:15:18 am
content: Quote from: brucehoult on February 09, 2023, 05:05:18 amFor a OS that aligned itself to years for versions, to release a version number like that could not have been a accident.

author: Psi
author_rank: Super Contributor
timestamp: February 09, 2023, 05:27:50 am
content: Quote from: eti on February 09, 2023, 05:09:57 amSorry I called you a troll.

author: eti
author_rank: Super Contributor
timestamp: February 09, 2023, 05:43:26 am
content: Quote from: Psi on February 09, 2023, 05:27:50 amI forgive you. Thanks mate.

author: JPortici
author_rank: Super Contributor
timestamp: February 09, 2023, 06:32:18 am
content: Quote from: eti on February 09, 2023, 04:56:41 amyou're not listening to radio, or looking at social media much thenI would actually agree with you, to set up a VM and nano / g++ from the command line, if that didn't mean that you have to know how to install a linux distro (which, again, is surprisingly easy these days, you just read and accept the defaults.)But why do that when you can go to onlinegdb and do the same thing? It's just textbook exercisesNow that i think of it, you are probably accused of being a troll because you dare suggesting nano instead of VIM (screw that, nano rules)

author: eti
author_rank: Super Contributor
timestamp: February 09, 2023, 09:40:57 am
content: Quote from: JPortici on February 09, 2023, 06:32:18 amI actually use emacs.Then again, I use nano, vim, whatever I’m in the mood for. I don’t have this ridiculous, childish “let’s make it our life’s mission to pick favourites, and ostracise those who don’t agree with us” mindset - they’re all just fools. I don’t argue “a screwdriver is better than pliers”; they’re different. People are SO easily led down rabbit holes, it’s almost comical.Yeah they’re all good depending on context and need. :-)

author: DiTBho
author_rank: Super Contributor
timestamp: February 09, 2023, 09:52:45 am
content: So, Visual Studio is still used for "Playstation development"I expected it to be, but, it's still full C and C++ support

author: martinribelotta
author_rank: Regular Contributor
timestamp: February 09, 2023, 03:02:06 pm
content: If you only need a scratchpad editor and C++ compiler maybe you will try an online environment like cpp.sh or the more powerfull (and complex) godbolt in the IDE version:https://godbolt.org/z/jdKdM434cAnother C++ environment is onlineGDB with an integrated debugger:https://www.onlinegdb.com/In my recomentadations you not need an ide, you need a text editor, a command line and a compiler like gcc in its many versions (by examples, the best alternative to use gcc and its tools is install msys2 and their gcc packages)The primary way to understand C (or C++) is understand the build process first