Author Topic: General IDE to learn C++ on  (Read 37496 times)

0 Members and 3 Guests are viewing this topic.

Offline DC1MC

  • Super Contributor
  • ***
  • Posts: 1925
  • Country: de
Re: General IDE to learn C++ on
« Reply #25 on: December 25, 2021, 10:23:59 am »
Regarding Code::Blocks, I leave this here, as is not so wide known:
Like many other IDEs, it has it's own project definition file (readable XML, not some (semi)binary rubbish), some times it is necessary to give your project in buildable source and a Makefile will help with the "purists" that do not conceive anything else than Makefiles.

So we have https://github.com/mirai-computing/cbp2make that converts the project to a pretty easy to understand Makefile, if a bit too verbose and explicit for the purists that come with the dreadful one-liners for the leet, that are uses to job security and showin off.

 Cheers,
 DC1MC

That made no sense to me at all. To restate for those running away with themselves:

1) i have a book
2) it has exercises that need to be compiled and run on a console
3) the IDE recomended does not really exist anymore
4) I need an IDE that will not do silly stuff like the book itself warns of VS of 2005 running the code you just wrote and then closing the console window so that you can't see the result and think you did it wrong despite it being fine.
5) I just need something that works without hours of learning it and how to make it not do it's own thing it thinks is what I want because ultimately I need to run on embedded so getting into the whole how this will compile a program for windowsn is not very relevant right now.

Simon, C::B does this by the default install, no need for other plugins or utilities except what is included in the default install, as some other forum member showed practically how to compile the "Hello world" example with C::B on the Windows platform, on Linux is even simpler. So just install it an run it, it takes maybe three minutes to test your examples.

The Makefile generator utility I've mentioned here in case you'll proceed further after the book and maybe share your project or give it to a customer.

I'm willing to drive you trough the hops with C::B and a couple of your book examples via Skype, Zoom, Jisti, whatever, as the weather here in the German industrial town is completely shite (pouring rain, 12C, wtf, is end of December  :scared: ) and I'm blocked in front of the PC anyway.

 Cheers,
 DC1MC
 

Offline paf

  • Regular Contributor
  • *
  • Posts: 96
Re: General IDE to learn C++ on
« Reply #26 on: December 25, 2021, 11:45:02 am »
Supposing you usually have a Windows PC, you have several alternatives:

1)  Install WSL2 and Debian or Ubuntu on WSL2 and VS Code or other editor on Windows. You can edit the files from Windows and run them on the WSL terminal.
2)  Install Virtual Box, a Linux  on Virtual Box, and define a shared folder.   You can edit the files from Windows and run them on Linux.
3)  Install Virtual Box, a Linux  on Virtual Box, and define a shared folder for file sharing.  You can edit the files on Linux using an editor/IDE like Geany.
4)  Install Linux on a PC.  You can edit the files on Linux using an editor/IDE like Geany, or any other simple editor.

On Linux/WSL besides using the latest version of gcc or llvm for compiling, when you don't understand what the hell is happening with your C/C++program, you can:

a) Use all the complier warnings
b) Use cppckeck   https://cppcheck.sourceforge.io 
c) Use splint      https://splint.org/   (Only C)
d) Run your program with Valgrind  https://valgrind.org
e) Debug your program with gdb (which has support for many embedded micros).

All these suggestions are also valid for embedded development.
 
 
 
 

Offline hgl

  • Regular Contributor
  • *
  • Posts: 110
  • Country: de
Re: General IDE to learn C++ on
« Reply #27 on: December 25, 2021, 11:58:09 am »
Quote
4) I need an IDE that will not do silly stuff like the book itself warns of VS of 2005 running the code you just wrote and then closing the console window so that you can't see the result and think you did it wrong despite it being fine.
Every C / C ++ program begins with calling "main" and ends with exiting main. If you do not want your console to close, simply add a keyboard query to the end of your code and wait for a key to be pressed.

Quote
5) I just need something that works without hours of learning it and how to make it not do it's own thing it thinks is what I want because ultimately I need to run on embedded so getting into the whole how this will compile a program for windowsn is not very relevant right now.



If you want to write embedded code you need a cross-compiler for your target system. Visual C can't do that. Usually GCC is used for this. There is no console in embedded systems without an operating system. Your code runs in an endless loop within main.

An online IDE can be used for the book examples. https://ide.judge0.com/
For embedded code, I would recommend Visual Studio Code with GCC. VSCodium is the same without Mirosoft extensions.
Is faster and easier to use than Eclipse.



 

Offline DC1MC

  • Super Contributor
  • ***
  • Posts: 1925
  • Country: de
Re: General IDE to learn C++ on
« Reply #28 on: December 25, 2021, 12:11:42 pm »
Supposing you usually have a Windows PC, you have several alternatives:

1)  Install WSL2 and Debian or Ubuntu on WSL2 and VS Code or other editor on Windows. You can edit the files from Windows and run them on the WSL terminal.
2)  Install Virtual Box, a Linux  on Virtual Box, and define a shared folder.   You can edit the files from Windows and run them on Linux.
3)  Install Virtual Box, a Linux  on Virtual Box, and define a shared folder for file sharing.  You can edit the files on Linux using an editor/IDE like Geany.
4)  Install Linux on a PC.  You can edit the files on Linux using an editor/IDE like Geany, or any other simple editor.

On Linux/WSL besides using the latest version of gcc or llvm for compiling, when you don't understand what the hell is happening with your C/C++program, you can:

a) Use all the complier warnings
b) Use cppckeck   https://cppcheck.sourceforge.io 
c) Use splint      https://splint.org/   (Only C)
d) Run your program with Valgrind  https://valgrind.org
e) Debug your program with gdb (which has support for many embedded micros).

All these suggestions are also valid for embedded development.
 

Because all of this complex stuff is so much easier for a beginner than downloading the Code::Blocks installation package with included gcc compilers for Windows: https://www.fosshub.com/Code-Blocks.html?dwl=codeblocks-20.03mingw-setup.exe
then after finishing his book examples go in Linux and get the same package plus whatever cross compilers and just retarget his project with a couple of clicks   :palm:
 

Offline JohanH

  • Frequent Contributor
  • **
  • Posts: 831
  • Country: fi
Re: General IDE to learn C++ on
« Reply #29 on: December 25, 2021, 12:22:23 pm »
If you want to learn embedded, learn to use linux command line and gcc. When you understand the basics, you can move to any platform and whatever bloated environment you want.
 

Offline djsb

  • Super Contributor
  • ***
  • Posts: 1122
  • Country: gb
Re: General IDE to learn C++ on
« Reply #30 on: December 25, 2021, 12:31:06 pm »
As a beginning programmer all I want to do is to get through the book and actually learn the language, NOT fight the IDE. This is why setting up the development environment is a big hurdle to get over.
Notpad++ and code:blocks works for me and I have the exact same book as Simon has. I've been put off actually reading the book until now as I have come across the same problems with bloated and intimidating IDE software.
David
Hertfordshire, UK
Retired University Electronics Technician, London, PIC16/18, CCS PCM C, Arduino UNO, NANO,ESP32, KiCad V10+, Altium Designer 21.4.1, Alibre Design Expert 28 & FreeCAD beginner. LPKF S103,S62 Operator, Electronics instructor. Credited KiCad French to English translator.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 11218
  • Country: fi
Re: General IDE to learn C++ on
« Reply #31 on: December 25, 2021, 12:31:48 pm »
1) i have a book
2) it has exercises that need to be compiled and run on a console

So you don't need an IDE. All you need is compiler and any text editor of your choice. I use gedit, used to use Notepad++ and Programmer's Notepad far in the past in my Windows days. Many have some helpful programming features like syntax highlighting without all the bloat. Minimize number of tools by not using unnecessary tools. Compiler itself can't be avoided.

You can configure many text editors to run a command on a keypress but I don't bother, with today's multitasking operating systems, why not just have multiple windows open, code editor in one window, command prompt in another.

Either write a makefile or if that sounds too compilated (I accept it is), just m.bat or m.sh, then just run m on the command prompt window and it compiles.

Compiling on g++ for example
g++ -Wall excercise.cc -o excercise[.exe]

You can even just write this and press the arrow up key and enter to compile.

Doesn't need to be made difficult.

With todays large display resolutions (1920 pixels minimum, and sometimes more! wow!), you can easily run the command prompt and the code editor side-by-side so that alt+tabbing doesn't mess up your visual concentration. Compared to this, some IDEs, at least by default, give a tiny output on the bottom of the screen which fits maybe 10 lines.
« Last Edit: December 25, 2021, 12:36:36 pm by Siwastaja »
 

Offline DC1MC

  • Super Contributor
  • ***
  • Posts: 1925
  • Country: de
Re: General IDE to learn C++ on
« Reply #32 on: December 25, 2021, 12:37:20 pm »
If you want to learn embedded, learn to use linux command line and gcc. When you understand the basics, you can move to any platform and whatever bloated environment you want.

Sure, after spending like 30min - 1h learning vi, then spend another hour or such to learn the advanced syntax for Makefiles and its interaction with gcc, also spend 2-3 hours to understood all the advanced gcc switches related to specific architectures, make sure to focus on your installed gcc version as they may produce different effects on each version, then CMake and Ninja meta-generators are a big help and makes your life easier, so spending another hour or two understanding them may help with complex projects, otherwise vi (vim if you want to go on the bloated way) and gdb should be enough for an absolute beginner  :-DD :palm:. All in all a Saturday* well spend for your future professional development.

* = It has to be noted that the hours mentioned above are Saturnian hours and a Saturnian Saturday as well, if done less frequently it may take a Saturnian month  >:D.

This is how all the experts on the forum learned this stuff, and they've now won by hard work and dedication the right to summarily dismiss all of those "bloated IDE" that do all this stuff with a couple of clicks.

NOTE: Code::Blocks is NOT bloated, is one of the most lightweight IDE for the feature it offers.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 14126
Re: General IDE to learn C++ on
« Reply #33 on: December 25, 2021, 12:54:17 pm »
The Orwell fork of Bloodshed DevC++ still works, and is a lot lighter than many other IDEs that have been suggested.
https://sourceforge.net/projects/orwelldevcpp/

However it is a bit fussy to set up to use a recent GCC compiler properly.  Grab TDM-GCC 10.3.0 from: https://jmeubank.github.io/tdm-gcc/ and install it.  You probably want (and only need) the 64 bit install unless you are using a legacy 32 bit Windows.  Make sure you add the MinGW tools folder to your user (or system) path (on my system that's C:\TDM-GCC-64\x86_64-w64-mingw32\bin ), otherwise Dev C++ cant do a 'Clean' or 'Rebuild All' successfully (the default makefile needs rm.exe to be findable on the path).

Next you need to set up the new TDM-GCC 10.3.0 compiler. in Dev C++.  Launch Dev C++ and without opening a project, open the menu 'Tools': 'Compiler Options'.  Use the 'Add a compiler set by folder' button (middle of the five grouped buttons - green +) and give it your TDM-GCC root folder (on my system that's C:\TDM-GCC-64 ).  Rename the new compiler from TDM-GCC 10.3.0 to TDM-GCC 10.3.0 64-bit Release (assuming your on Win x64).  Now add another instance of the same compiler, but this time rename it to TDM-GCC 10.3.0 64-bit Debug and in the tab 'Settings': 'Code Generation', set the 'Optimization level (-Ox)' to 'Debug (g)', in the tab 'Settings': 'Linker', set  'Generate debugging information (-g3)' to 'Yes', and check that 'Strip executable (-s)' is set to 'No'.

For convenience, you may wish to add some utilities to the Dev C++ tools menu (by 'Tools': 'Configure tools...').

I have:

'Explore Project Files' which invokes explorer.exe with parameters <PROJECTPATH>

'Console (in project folder)' which invokes C:\Windows\System32\cmd.exe with working directory <PROJECTPATH>

You should now be able to follow any reputable Dev C++ tutorial, or book using Dev C++ with no IDE or toolchain issues.

 

Offline m k

  • Super Contributor
  • ***
  • Posts: 3486
  • Country: fi
Re: General IDE to learn C++ on
« Reply #34 on: December 25, 2021, 02:49:59 pm »
You can configure many text editors to run a command on a keypress but I don't bother, with today's multitasking operating systems, why not just have multiple windows open, code editor in one window, command prompt in another.

+1

I'm usually reading manuals in Adobe Reader same way, just make enough copies.

I've used Borland stuff for quite some time.
Can't open a window with MFC.

Community stuff seems to be timed these days.
May, after all, be a better way
Advance-Aneng-Appa-AVO-Beckman-Danbridge-Data Precision-Data Tech-Fluke-General Radio-H. W. Sullivan-Heathkit-HP-Kaise-Kyoritsu-Leeds & Northrup-Mastech-OR-X-REO-Schneider-Simpson-Sinclair-Tektronix-Tokyo Rikosha-Topward-Triplett-Tritron-YFE
(plus work shop of the world unknowns)
 

Offline TheCalligrapher

  • Regular Contributor
  • *
  • Posts: 190
  • Country: us
Re: General IDE to learn C++ on
« Reply #35 on: December 25, 2021, 05:08:55 pm »
On Linux/WSL besides using the latest version of gcc or llvm for compiling, when you don't understand what the hell is happening with your C/C++program, you can:

a) Use all the complier warnings

If you are using GCC for learning, the first and foremost thing you can do (in both C and C++) is specify `-pedantic-errors` so that the compiler reports errors as errors. A experienced programmer can usually tell, which of GCC "warnings" is not really a warning but a hard error. A student usually can't. This is where `-pedantic-errors` comes to the rescue.

This is, of course, if you want to learn the actual language, instead of the motley/pidgin dialect implemented by GCC in its default configuration.
 
The following users thanked this post: paf, nctnico

Offline Ed.Kloonk

  • Super Contributor
  • ***
  • Posts: 4000
  • Country: au
  • Cat video aficionado
Re: General IDE to learn C++ on
« Reply #36 on: December 25, 2021, 05:29:51 pm »
Quick question.

Does anybody use Kdevelop anymore?
iratus parum formica
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 13080
  • Country: us
Re: General IDE to learn C++ on
« Reply #37 on: December 25, 2021, 05:59:37 pm »
That made no sense to me at all. To restate for those running away with themselves:

1) i have a book
2) it has exercises that need to be compiled and run on a console
3) the IDE recomended does not really exist anymore
4) I need an IDE that will not do silly stuff like the book itself warns of VS of 2005 running the code you just wrote and then closing the console window so that you can't see the result and think you did it wrong despite it being fine.
5) I just need something that works without hours of learning it and how to make it not do it's own thing it thinks is what I want because ultimately I need to run on embedded so getting into the whole how this will compile a program for windowsn is not very relevant right now.

Did you read my post about online web consoles like godbolt.org? It will do fine for small book examples. It's what experienced programmers use to test things all the time.
 
The following users thanked this post: gamalot

Offline DC1MC

  • Super Contributor
  • ***
  • Posts: 1925
  • Country: de
Re: General IDE to learn C++ on
« Reply #38 on: December 25, 2021, 06:23:52 pm »
Quick question.

Does anybody use Kdevelop anymore?

I think that, except for some QT development, it went into the way of Anjuta.
 
The following users thanked this post: Ed.Kloonk

Offline paf

  • Regular Contributor
  • *
  • Posts: 96
Re: General IDE to learn C++ on
« Reply #39 on: December 26, 2021, 11:53:05 am »
Installing Linux (using WSL2) is easy and fast. When using Linux, if you have a shared folder with WSL2 or Virtual Box, you can use any Windows editor you want/like to edit  the source files,  and user the Linux command line to compile and run the programs.

Even when using Linux you are not forced to use vi(m) or emacs to edit the source code. Other beginner friendly "terminal" editors available are nano, pico, joe, micro, ash and jed.
In graphical mode you have Notepad++, Geany, Kate, Atom, Sublime Text or Visual Studio Code.       

Another fast and easy way (but somewhat limited) way of having a Linux command line machine that allows compiling C++ code is grabbing an Android device and installing Termux on it:
https://termux.com

Another suggestion about embedded C++ is going to YouTube, search for "Dan Saks" and watch his videos.
« Last Edit: December 26, 2021, 12:02:08 pm by paf »
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18894
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: General IDE to learn C++ on
« Reply #40 on: December 26, 2021, 02:46:20 pm »
That made no sense to me at all. To restate for those running away with themselves:

1) i have a book
2) it has exercises that need to be compiled and run on a console
3) the IDE recomended does not really exist anymore
4) I need an IDE that will not do silly stuff like the book itself warns of VS of 2005 running the code you just wrote and then closing the console window so that you can't see the result and think you did it wrong despite it being fine.
5) I just need something that works without hours of learning it and how to make it not do it's own thing it thinks is what I want because ultimately I need to run on embedded so getting into the whole how this will compile a program for windowsn is not very relevant right now.

Did you read my post about online web consoles like godbolt.org? It will do fine for small book examples. It's what experienced programmers use to test things all the time.

Yes, that is also a way of doing it.
 

Offline DrG

  • Super Contributor
  • ***
  • !
  • Posts: 1199
  • Country: us
Re: General IDE to learn C++ on
« Reply #41 on: December 26, 2021, 03:43:19 pm »
I don't know C++ either and, on occasion, consider learning/doing more in that arena. When I have dabbled, I use some form of VS. I have the newer 'community' version as well as some 2012 or so (too lazy to look). The position that they are bloated and a pain is justifiable.

So, I thought about your general example, "I got this book and they say to use____". In this case I was looking at https://www.amazon.com/Hours-Sams-Teach-Yourself-6th/dp/0672337460 to see what they recommended and they said:

MinGW-w64 https://sourceforge.net/projects/mingw-w64/ Which looks interesting and I don't think it has been mentioned in this thread.

https://www.mingw-w64.org/

They also mentioned VS varieties which has already been discussed.
- Invest in science - it pays big dividends. -
 

Offline djsb

  • Super Contributor
  • ***
  • Posts: 1122
  • Country: gb
Re: General IDE to learn C++ on
« Reply #42 on: December 26, 2021, 04:05:57 pm »
You can download Code:Blocks with the MinGW compiler included (which means it is installed alongside C:B) or opt to download C:B without the compiler if you already have one installed or want to install it separately.

https://www.codeblocks.org/downloads/binaries/
« Last Edit: December 26, 2021, 04:07:43 pm by djsb »
David
Hertfordshire, UK
Retired University Electronics Technician, London, PIC16/18, CCS PCM C, Arduino UNO, NANO,ESP32, KiCad V10+, Altium Designer 21.4.1, Alibre Design Expert 28 & FreeCAD beginner. LPKF S103,S62 Operator, Electronics instructor. Credited KiCad French to English translator.
 

Offline ejeffrey

  • Super Contributor
  • ***
  • Posts: 4841
  • Country: us
Re: General IDE to learn C++ on
« Reply #43 on: December 28, 2021, 03:12:37 am »
You are simply not going to find anything reasonably called an IDE that isn't "bloated"

You can use your favorite advanced text editor plus manage your own tool installation, setup and build system or you can get a bloated IDE.  Those are your options.

Mostly the only games in town for IDEs are visual studio, eclipse, and jetbrains each of which come in several variants. They are all huge but they will all do what you need (and much more)

Or you could install Linux or WSL and use g++ from the terminal. That's a good thing to learn anyway.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18894
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: General IDE to learn C++ on
« Reply #44 on: December 28, 2021, 01:16:14 pm »
My point was that the book recommended visual studio based on what it was in 2005, I am fairly sure that it is a bit different now in 2021. I never did get the exercise to work.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 30199
  • Country: nl
    • NCT Developments
Re: General IDE to learn C++ on
« Reply #45 on: December 28, 2021, 01:55:47 pm »
I have "the book" "Programming principles and practice using C++" by Bjarne Stroustrup. It has example and exercises and he recommends visual studio but this was in 2005. Visusual studio or whatever it is called now it rather bloated for running a few lines of code. Anything else worth using?
No. If you want to get serious about programming in C/C++ you will want to learn how to use a proper IDE. Eclipse CDT comes with a lot of useful features out of the box (like realtime syntax checking, outlines, function cross references, etc, etc). Visual Studio Code is also a good option but you will have to add a whole bunch of plugins to get it to the comfort level of Eclipse CDT.

Going the text-editor / command line route will only lead to more frustration. Going through pages of warnings trying to find the error message that prevents your program from compiling. OR missing that important warning about a bad type conversion.

If you want to venture further down the software development path: I can highly recommend to learn how to use Git. It makes life a lot easier because it allows to you to go back to previous versions (if you cared to commit them) and thus making experimenting with bits of code much easier.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18894
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: General IDE to learn C++ on
« Reply #46 on: December 28, 2021, 02:06:48 pm »
At the moment I just need to follow the exercises in the book. My first use will be in microchip studio for embedded stuff. Anything else will come later.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 30199
  • Country: nl
    • NCT Developments
Re: General IDE to learn C++ on
« Reply #47 on: December 28, 2021, 05:23:25 pm »
But how are you going to test your code? Step through it line by line with a debugger for example to see what is happening with the variable values. That is much easier to do on a PC based IDE than on a microcontroller. Likely Eclipse CDT and Visual Studio code offer a way easier to use workflow compare to Microchip's own IDE. Last time I had to program for a PIC processor I used Eclipse CDT instead of Microchip's own environment.
« Last Edit: December 28, 2021, 05:25:19 pm by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline Ed.Kloonk

  • Super Contributor
  • ***
  • Posts: 4000
  • Country: au
  • Cat video aficionado
Re: General IDE to learn C++ on
« Reply #48 on: December 28, 2021, 05:32:09 pm »
But how are you going to test your code? Step through it line by line with a debugger for example to see what is happening with the variable values. That is much easier to do on a PC based IDE than on a microcontroller. Likely Eclipse CDT and Visual Studio code offer a way easier to use workflow compare to Microchip's own IDE. Last time I had to program for a PIC processor I used Eclipse CDT instead of Microchip's own environment.

As an aside, this youtuber shows how to do it with VS.


iratus parum formica
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 10088
  • Country: us
Re: General IDE to learn C++ on
« Reply #49 on: December 28, 2021, 05:58:38 pm »
Once those steps are well understood, you can switch to something more comfortable than the command line.  The IDE I liked most was Visual Studio from Microsoft.  There is a free and open source version of it, for any OS.  The Linux one is called "VS Code".  One of the best IDE out there, can be used with any programming language.

Except...  It won't print your files!  To me, this seems like a really HUGE failing.  Nevertheless, I use it for Python and VHDL and when I want a listing, I use Notepad++.

I would just get used to Visual Studio Community Edition (free) on Windows.  For Linux, I would probably just use GCC from the command line.  I run gfortran from Eclipse so I'm into most of the high end IDEs.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->