Author Topic: all i want to do is run a C++ example  (Read 6415 times)

0 Members and 1 Guest are viewing this topic.

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11895
  • Country: us
Re: all i want to do is run a C++ example
« Reply #25 on: February 07, 2023, 03:11:58 pm »
Correct, 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.

Bloody 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.
 

Online shapirus

  • Super Contributor
  • ***
  • Posts: 1370
  • Country: ua
Re: all i want to do is run a C++ example
« Reply #26 on: February 07, 2023, 03:16:31 pm »
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.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17818
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: all i want to do is run a C++ example
« Reply #27 on: February 07, 2023, 05:18:23 pm »
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.

Over 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" ;)
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11895
  • Country: us
Re: all i want to do is run a C++ example
« Reply #28 on: February 07, 2023, 05:27:27 pm »
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.

This 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.
 

Online shapirus

  • Super Contributor
  • ***
  • Posts: 1370
  • Country: ua
Re: all i want to do is run a C++ example
« Reply #29 on: February 07, 2023, 05:30:16 pm »
trying to download GCC
this 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 use WSL, it's going to be just as simple, as far as I understand (never personally used it though -- I use native linux).
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12864
Re: all i want to do is run a C++ example
« Reply #30 on: February 07, 2023, 05:34:11 pm »
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!
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11895
  • Country: us
Re: all i want to do is run a C++ example
« Reply #31 on: February 07, 2023, 05:35:24 pm »
this 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 use WSL, it's going to be just as simple, as far as I understand (never personally used it though -- I use native linux).

But 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.
 
The following users thanked this post: langwadt, Ian.M, newbrain, JPortici

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12864
Re: all i want to do is run a C++ example
« Reply #32 on: February 07, 2023, 05:43:35 pm »
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.
 

Online shapirus

  • Super Contributor
  • ***
  • Posts: 1370
  • Country: ua
Re: all i want to do is run a C++ example
« Reply #33 on: February 07, 2023, 05:44:41 pm »
But Simon is not on Linux, so talking about Linux is just a waste of time.
it'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.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14488
  • Country: fr
Re: all i want to do is run a C++ example
« Reply #34 on: February 07, 2023, 08:10:49 pm »
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.
 :popcorn:
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17818
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: all i want to do is run a C++ example
« Reply #35 on: February 07, 2023, 08:30:28 pm »
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.
 :popcorn:

I 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!!!
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11895
  • Country: us
Re: all i want to do is run a C++ example
« Reply #36 on: February 07, 2023, 09:21:30 pm »
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!!!

But 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?
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17818
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: all i want to do is run a C++ example
« Reply #37 on: February 07, 2023, 09:31:50 pm »
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
 

Offline nigelwright7557

  • Frequent Contributor
  • **
  • Posts: 690
  • Country: gb
    • Electronic controls
Re: all i want to do is run a C++ example
« Reply #38 on: February 07, 2023, 09:35:11 pm »
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.

 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11895
  • Country: us
Re: all i want to do is run a C++ example
« Reply #39 on: February 07, 2023, 09:45:10 pm »
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

Are you trolling, maybe? You have been told about Visual Studio many times and you don't even respond or acknowledge it.
 

Online langwadt

  • Super Contributor
  • ***
  • Posts: 4430
  • Country: dk
Re: all i want to do is run a C++ example
« Reply #40 on: February 07, 2023, 09:46:00 pm »
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 ...
 
The following users thanked this post: newbrain

Online shapirus

  • Super Contributor
  • ***
  • Posts: 1370
  • Country: ua
Re: all i want to do is run a C++ example
« Reply #41 on: February 07, 2023, 09:51:31 pm »
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 ...
Well done.
I have to retract my recommendation for Linux. It won't help.
 

Offline nigelwright7557

  • Frequent Contributor
  • **
  • Posts: 690
  • Country: gb
    • Electronic controls
Re: all i want to do is run a C++ example
« Reply #42 on: February 07, 2023, 10:01:16 pm »
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.
That's a good point, quite a few microcontrollers IDE's just use C.
 

Offline Ed.Kloonk

  • Super Contributor
  • ***
  • Posts: 4000
  • Country: au
  • Cat video aficionado
Re: all i want to do is run a C++ example
« Reply #43 on: February 07, 2023, 10:14:18 pm »


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?


The 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.
« Last Edit: February 07, 2023, 10:17:56 pm by Ed.Kloonk »
iratus parum formica
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11895
  • Country: us
Re: all i want to do is run a C++ example
« Reply #44 on: February 07, 2023, 10:19:29 pm »
The 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.

I 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?
 

Online shapirus

  • Super Contributor
  • ***
  • Posts: 1370
  • Country: ua
Re: all i want to do is run a C++ example
« Reply #45 on: February 07, 2023, 10:24:10 pm »
That's a good point, quite a few microcontrollers IDE's just use C.
Yes, 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.
« Last Edit: February 07, 2023, 10:30:21 pm by shapirus »
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17818
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: all i want to do is run a C++ example
« Reply #46 on: February 07, 2023, 10:30:11 pm »
The 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.

I 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?

No 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" ?
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11895
  • Country: us
Re: all i want to do is run a C++ example
« Reply #47 on: February 07, 2023, 10:31:40 pm »
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.

You 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.
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11895
  • Country: us
Re: all i want to do is run a C++ example
« Reply #48 on: February 07, 2023, 10:34:02 pm »
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" ?

Be aware that you talked about VS Code which is NOT Visual Studio. You do not want Code, you want Visual Studio. Follow the links above, or Google for "Visual Studio Community Edition".
 

Online shapirus

  • Super Contributor
  • ***
  • Posts: 1370
  • Country: ua
Re: all i want to do is run a C++ example
« Reply #49 on: February 07, 2023, 10:35:55 pm »
You 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.
Sure 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++.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf