Register | Sign In


Understanding through Discussion


EvC Forum active members: 65 (9162 total)
6 online now:
Newest Member: popoi
Post Volume: Total: 915,817 Year: 3,074/9,624 Month: 919/1,588 Week: 102/223 Day: 13/17 Hour: 1/1


Thread  Details

Email This Thread
Newer Topic | Older Topic
  
Author Topic:   Visual Studio Code ... How To?
dwise1
Member
Posts: 5930
Joined: 05-02-2006
Member Rating: 5.8


Message 1 of 6 (895717)
07-14-2022 1:49 AM


There's a "great" new (released Nov 2015) editor/IDE, Visual Studio Code (AKA "VS Code"):
quote
Visual Studio Code, also commonly referred to as VS Code, is a source-code editor made by Microsoft for Windows, Linux and macOS. Features include support for debugging, syntax highlighting, intelligent code completion, snippets, code refactoring, and embedded Git. Users can change the theme, keyboard shortcuts, preferences, and install extensions that add additional functionality.
In the Stack Overflow 2021 Developer Survey, Visual Studio Code was ranked the most popular developer environment tool, with 70% of 82,000 respondents reporting that they use it.
Does anybody here use it? Because I cannot decipher the documentation nor several YouTube "tutorials" to the point where I can figure out how to create a project in C++.
I am a retired software engineer (Aug 1982-Jan 2018, so about 34 years of professional experience). First 13 years I worked in assembly and Pascal, including a few versions of Turbo Pascal to Borland Pascal. Then after two years of intensive work in C++, I spent my last 22 years working in C for embedded programming projects and C++ from a few utility applications.
In all that time, I had extensive experience working in IDEs: Turbo Pascal, Borland Pascal, Turbo C, Turbo C++, Borland C++, Microsoft Visual C++ 1.0, Visual C++ 6, Visual Studio 2008, plus a few sundry others. So I am not lacking in training nor in experience.
I had no problem creating and managing projects in any of those IDEs. So why does VS Code make no sense? There's no mention of projects, but rather "folders" and "workspaces" which I'm told are not the same thing (and even that I'd probably never use a workspace, so what are they used for? No answer.).
Figuring that they're just using that Mac-esque "desktop" euphemism, I would assume that their "folder" is the same thing as a subdirectory, but while I could have many other files in a directory that were not in the project that was never a problem before since I could add files to the project explicitly. But I cannot find any way to do that here.
Although I've done almost no programming since retiring, I do have a few projects in mind. Using an IDE to group source files together in a project would make things easier than doing it in my favorite text editor which I also use for 240 other text files (almost all of my writing is with text files, except for my Russian study notes for which I need Word and the Russian keyboard).
I also use MinGW's gcc, since that enables me to work on code on my laptops as well as my desktop. That problem with VS Code is apparently solved.
Does anybody know of any documentation anywhere that just answers the simple question of how to create a C++ project plus basic caveats (eg, if you cannot choose which files in a directory to include, then how do you handle that (unless their "folder" is something completely different)?) One that doesn't do so much hand-waving and tossing about stupid buzzwords like Git?
Or have I been spoiled by decades of decent documentation in sharp contrast to the modern paradigm of "flail about lost for months until you finally figure everything out on your own"? Because "the whole idea is the experience of exploration, like playing an old game of Adventure" (eg, look inside the hollow log).

Replies to this message:
 Message 2 by Stile, posted 07-14-2022 8:31 AM dwise1 has replied
 Message 3 by Percy, posted 07-14-2022 8:39 AM dwise1 has replied

  
dwise1
Member
Posts: 5930
Joined: 05-02-2006
Member Rating: 5.8


Message 4 of 6 (895721)
07-14-2022 2:17 PM
Reply to: Message 2 by Stile
07-14-2022 8:31 AM


Re: I dunno
But, anyway, a quick Google search of "c++ project in visual studio code" brings up a page that seems to suggest that native Visual Studio Code does not support C++ programming. You need to install an extension pack to support the code, and you may also need a C++ compiler installed as well.
Already done. I got MinGW gcc several years ago to use as a handy compiler to use from the command line. I started out as a DOSer and even when Windows went completely GUI with Win95 the first thing I would do every day at work would be to open a "DOS window" in order to be able to do anything useful. That sadly became so much truer when they broke the search utility in Windows 7 making it unusable (I suspect that started with Vista, which I never had to endure -- I would quite literally tell search to find a file I could see right there in the directory by name and it quite literally reported that it couldn't find it), so the only way I could do a proper search was with grep. But then Win10 went 64-bit, so my GNU UNIX utilities, which were all 16-bit, could no longer run.
The reason for my personal connection with the search utility was because when I was married my wife needed to use Word but absolutely refused to learn how to use it (she literally wanted me to stand behind her and tell her every key to press, which I could not agree to). She even refused (ie, fought tooth and nail against) to learn that she needed to give her document a name and to know which directory she saved it to. So the constant scenario was that she would come to me complaining very bitterly that my stupid computer had lost he document that she had created a couple days before. "OK, where did you save it?" "I don't know!" "What did you name it?" "I don't know! Just fix your stupid computer!!!!" So I would use search to find the .doc file that has been created or modified within the time period in question and it found her file every time -- surely wouldn't have worked with the "improved" version. She always wanted a Mac like at work (teacher -- Apple was very smart by donating their computers to schools so that kids would grow up with them, but then businesses made the smart business decision to use PCs so all that training went to waste), but I told her that if I got her one then I would not be able to help her at all (fellow engineer at work had to get his wife a Mac; his tales of having to try help her despite the illogic of Apple products were horrifying). The irony would have been that even a Mac would require her to name her document and to know what she had saved it -- and I would not have been able to search for it, so she would have been completely SOL and deservedly so.
Anyway, using gcc I could simply copy those directories to my laptops (and my work computer) and be in business without having to spend hours installing Microsoft's Visual Studio which is over-kill for most personal projects (and on my laptops, a few of which have been cheap "beaters" I would use mainly for writing and whose demise would not distress me).
C++ programming with Visual Studio Code
If you've already done that, then I'm sorry for being basic, and I'm no help. Good luck!
Already read that. The only thing it told me was how to modify my PATH environment variable to include my compiler's executable. I could always just edit my AUTOEXEC.BAT file to include the paths I needed, but then Windows "got too smart to need that file" and I would have to try to figure out what they had hidden that feature. And it seemed that every single new version of Windows would invent some new place to hide its features. I had to create a batch file to modify PATH and store it in my C:\UTIL directory (which was in PATH) so that I could run it every time I opened a DOS window. But now that VS Code "documentation" included instructions for modifying PATH which I never could have found on my own.
As a fellow programmer would rephrase a line by Norm in Cheers: "Computers! Can't live with them ... pass the beer nuts." (in the original, it was "Women!").

This message is a reply to:
 Message 2 by Stile, posted 07-14-2022 8:31 AM Stile has seen this message but not replied

  
dwise1
Member
Posts: 5930
Joined: 05-02-2006
Member Rating: 5.8


Message 5 of 6 (895722)
07-14-2022 4:34 PM
Reply to: Message 3 by Percy
07-14-2022 8:39 AM


Sorry, I'm rambling. Let me know if you want me to take a look at VS Code. It would be on a Mac.
I wouldn't want you to waste your time and suffer the frustration. I have a buzz cut so I cannot grab my hair and tear it out, but you might not have that safety feature yourself.
Git is both amazing and incredibly frustrating, ...
I couldn't even find out what that is supposed to be. The only reference to "git" was from the White Album ("and curse Sir Walter Raleigh he was such a stupid git"). Along with my referring to Matt Gaetz as "Matt Git". Because of him, every time someone mentions Venmo the only use for it that I can think of is for paying for sex with underage girls -- his court date on that was delayed because of COVID, but I haven't heard when it's been rescheduled for. I still cannot understand why he wasn't arrested and imprisoned immediately for violating national security when he led that GOP mob to storm and compromise that SCIF (sensitive compartmented information facility).
I wonder if this was the way machine coders felt back when assemblers were first coming on-line and then compilers.
Those first programmers had to know how the computer was wired, especially true for the ENIAC which you programmed literally by rewiring it with gang switches and patch cords. Ironically, it was the women working on that project who figured out how to make it work and hence were the early programmers (of course, the title of first computer programmer goes to a woman, Ada Augusta, born in 1815 -- hence the designation of the ADA language spec, MIL-STD-1815). The PBS show, Top Secret Rosies: The Female "Computers" of WWII, is still on Amazon Prime, I think.
When I started on my Computer Science degree in 1977, we learned on the university computer, an IBM S/370 which emulated a 360. That was my first assembly language and I could read machine code and EBCDIC in the hex dumps we'd get when our jobs would crash. In the subsequent 34 years I never could learn to do the same with ASCII and 8086 assembly. Assembly is actually fairly straight-forward since there's a one-to-one correspondence between each assembly instruction and its equivalent machine code. In one class our programming project was to write a two-pass assembler, which conceptually was very simple. It's compilers where there's no direct correspondence between source code and machine code -- at one job, I would design the assembly code for our 8048 microcontrollers by writing the routine in Pascal and then hand-compile it to assembly, keeping the original Pascal code as the comments (I was a firm believer in self-documenting code).
... I don't use IDE's. I still prefer Emacs.
When I started at my last job (for 22 years until retirement in 2018, so I really lucked out by remaining continuously employed through financial crises and being too old to find a new job), they had gotten a DOS version of vi, so that was what we used in the lab. For Linux, I just stuck with vi and never tried Emacs. It did though help me appreciate EDLIN, the standard MS-DOS line editor which at a previous job I used to have to walk our customers, greenhouse growers, through -- and I would literally do it with my eyes closed, something that would be near impossible to do in a GUI. vi was built on top of an older UNIX editor which I think was called "ed" and which is still a part of vi as the colon commands. You could write an ed script that you could then use to edit several files. Playing around, I found that we could do the same thing with EDLIN.
At work, most of our projects (in C) consisted of more than a hundred source files (and just as many header files, but those were referenced in the source files that used them). It was necessary to have a project to manage them. We would also use makefiles (Visual C++ would generate a makefile from the project file), but my version of make is 16-bit so it no longer runs on my 64-bit Win10 box, the fate of all my GNU UNIX utilities.
I have done almost no programming since retiring in Jan 2018 except for part of a simple program to practice Morse code (I figure it will come in handy later when I've had a stroke and can only communicate by blinking my eyes). There are a few wargame projects I have in mind, including a decades-old project for managing Larry Bond's naval miniatures wargame, Harpoon (he had helped Tom Clancy with Hunt for Red October by using his game to playtest the book's sea battles).
At the time (c. 1985), a friend and I had tried Harpoon's simple introductory scenario of a 20-minute engagement between a US destroyer and three Soviet missile boats which too. Using rulers and graph paper, it took us more than two hours to get about a third of the way through, so I decided that there must be a better way which led to my "Harpoon Helper" project.
At first I worked on the interface which was a recreation of Turbo Pascal's IDE's TUI (textual user interface) in Pascal, my language of choice at the time. Working through the pull-down menus was complicated and I got it to work though there were a couple bugs I couldn't solve. Then I learned C++ so I redid the TUI in C++ using OOP. That was so incredibly simpler plus no bugs! But then there was Windows which eliminated the need for creating a UI, so I started working on learning that. All of which was in my copious spare time left over after work, refresher computer training, reserve duty, raising a family, Scouts, etc. So I still have not made much progress on Harpoon Helper.
BTW, when Hunt for Red October the story was that the Navy brass got upset and wanted to know where he had gotten all that information from. Well, Larry Bond had gotten it from public sources such as Jane's books. Fred Jane had started compiling and publishing his books, starting with Warships of the World, to be used as reference materials to support his own naval wargame published in 1906. In 1921, the Royal Navy created its own naval wargame whose tactical segment was based on Jane's game, but most of which involved extended fleet operations (and hence included logistics and ships' ranges and refueling) and mainly dealt with chain-of-command and communications. The admirals would issue orders to fleet commanders and their knowledge was limited to reports they received. Same with fleet commanders on down the line.
About a year ago I learned about the Western Approaches Tactical Unit (WATU, but on YouTube use the full name or else you'll only get videos of a band) attached to Western Approaches Command (WAC) in Liverpool. As WAC was running the Battle of the Atlantic, WATU used wargaming to analyze U-boat operations and tactics and to develop effective countermeasures. In one extended engagement that lasted for days, the convoy would radio reports of what was happening to WAC who would give that information to WATU who analyzed it and developed tactics which WAC radioed back to the convoy. After the war, WATU CO Captain Gilbert Roberts visited the Kriegsmarine HQ and saw a photograph of him displayed on the wall with the caption, "This is your enemy!", a tribute to WATU's effectiveness.
quote
What makes WATU a noteworthy episode in the history of military wargaming is that it used wargames to investigate real scenarios that were occurring during an ongoing war and develop solutions that were immediately implemented in the field. By contrast, most wargames are played during peacetime to prepare officers for potential wars, and the scenarios they explore either are hypothetical or happened many years ago, and may not be relevant to the next conflict when it comes due to unforeseen factors such as new technology or rules of engagement.
WATU was manned primarily by young WRNS ("Wrens"), members of Women's Royal Naval Service, most of them enlisted. The most famous anecdote from WATU was when they were visited by WAC's new CO, Admiral Max Horton, who had been Britain's ace submarine commander in WWI. Skeptical of WATU, he commanded a German U-boat and attacked the convoy whose commander was in another room and only acted on the referees' reports. He was immediately sunk, so they ran the scenario again several times and each time he was sunk almost immediately. Greatly impressed, he wanted to meet that convoy commander since WAC needed such highly skilled officers out in the fleet commanding those convoys. That is when he was introduced to Janet Okell, a 20-year-old WRNS rating (ie, enlisted member, not an officer):
quote
Janet Hay Okell (30 August 1922, Neston – February 2005, Brimstage) was an English wargamer who joined the Western Approaches Tactical Unit (WATU) as a young Naval rating in the Women's Royal Naval Service. Shortly after Admiral Max Horton was appointed Commander-in-Chief of the Western Approaches Command, in November 1942, he visited WATU, and played one of their wargames. As one of the Royal Navy's most experienced submarine commanders he opted to play the role of a U-boat commander. Captain Gilbert Roberts, head of WATU decided that Okell should play the role of the escort group commander. Horton was somewhat dismayed to find that Okell was able to outsmart him five times out of five. Despite his initial horror on discovering he had been beaten by a twenty year old female rating, he soon sanctioned the use of her method, known as Beta Search to be included in the next revision of Fleet Orders.
Part of my Harpoon Helper project was to include networking. I had even started to develop a protocol based on HTTP with a header that defined the body of the message. I had that written out more fully than I can find right now, which is part of my problem.
 
But more pressing is the revamping of my Math Drill program, which I originally wrote in Turbo Pascal under DOS so I was able to print the drill exercises directly from my computer (we no longer have that capability). My younger son was having difficulty in his algebra class suffering much from exam anxiety. I figured it was because his arithmetic skills were weak, especially in multiplication. When he was taught multiplication, the teacher only worked them in the concepts which he understood immediately, but didn't drill them in the multiplication tables expecting them to do that on their own. I'm planning ahead for helping my grandsons with their homework, which will be a while (they're 3 and 2 years old now).
So I set up a training program for him which started with a sheet of arithmetic problems. Then I would go over his homework with him. He would complain that he didn't know how to do the problems, so I taught him how to use the textbook which I referred to as "RTFM" ("Read the f'ing manual!"):
  • The problems in the section are based on what was taught in that section.
  • The section would walk through how to apply what was being taught.
  • At the end of the section there would be a sample problem wherein the author explains how to solve that kind of a problem.
  • Therefore, to figure out how to approach the problem in question, first look to that sample problem, working backwards into the section's materials and even into preceding sections as needed
Within a week, he improved immensely and no longer needed my guidance. And when he would ask for help, my first response would be "RTFM!" and then go through reading the manual with him.
To generate those worksheets, I wrote a Pascal program (still my language of choice at the time) that picked multipliers and multiplicands at random and print them out as problems. As I said, at that time I could simply print to the PRN device, something that Windows no longer allows.
What I need to do is to convert my .pas source files to .c or .cpp. In order to get around the issue of learning how to print in Windows (not trivial), I will save the worksheet to a text file which I can then print through another application.
 
The problem with these projects is that when I come back to them I have to reconstruct what I was doing. That includes having multiple versions of files, only some of which are current. Being able to group them into a project would help greatly.
In addition, as I alluded to in the OP, I have a great many text files that I'm working on in my text editor (Note Tab Pro; I love it). The open files are listed on the side in alphabetical order, so the various project files are scattered throughout that list.
On the face of it, VS Code looked like it could be useful. Except so far there's practically no way to learn how to use it except to just slog through using trial-and-error. Again, good thing my hair is so short so that I cannot tear it out by the roots in frustration.

This message is a reply to:
 Message 3 by Percy, posted 07-14-2022 8:39 AM Percy has seen this message but not replied

  
dwise1
Member
Posts: 5930
Joined: 05-02-2006
Member Rating: 5.8


Message 6 of 6 (895723)
07-14-2022 7:49 PM
Reply to: Message 3 by Percy
07-14-2022 8:39 AM


Just a follow-up on naval wargaming.
Part of the tradition of the Naval War College in Newport, Rhode Island, is wargaming.
A YouTube channel, Invicta, did a tour of the Naval War College and made a number of videos on the subject, such as (his other videos on that subject should be accessible from that link):
Naval wargaming, particularly Fletcher Pratt's game of circa 1940, was a popular date night event (almost as good as watching the submarine races) making use of ballroom floors after the jitterbugs had left. It was said that you could spot the gamers by the chalk marks on their cheeks. There is one story of a gaming couple in which she commanded a submarine that sank two of his cruisers. A couple months later they were divorced (male ego so easily deflated).
One of the things that the professional military does very well is planning. What if Canada goes to war against us? There are undoubtedly a series of war plans addressing that contingency and many others, regardless of whether or not we would ever wish to go to war against Canada. It is said that one of the military problems encountered as we entered into supporting the UK in WWII is that most of our military planning had centered around a war against the UK.
In 2015 I went on a cruise out of Southampton on which we left harbor past Calshot Castle, a Henry VIII fortification that had been further fortified in 1894 against French invasion. On a second cruise the next year, we sailed past one of the Solent forts, man-made island forts built circa 1860 for defense against the French. I believe it might have been the No Man's Fort, a hotel venture which was used for location shooting of episodes of the Third Doctor series of Doctor Who, The Sea Devils.

This message is a reply to:
 Message 3 by Percy, posted 07-14-2022 8:39 AM Percy has seen this message but not replied

  
Newer Topic | Older Topic
Jump to:


Copyright 2001-2023 by EvC Forum, All Rights Reserved

™ Version 4.2
Innovative software from Qwixotic © 2024