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

0 Members and 5 Guests are viewing this topic.

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 14132
Re: General IDE to learn C++ on
« Reply #100 on: January 12, 2023, 10:19:13 am »
Caution: Cigwyn (and also various GCC based toolchains) can break totally unrelated Windows CMD scripts (.bat, .cmd).   The culprit is often the FIND command, which has very different syntax in its Linux and Windows command line versions.   You can reorder the path so the Windows version comes first, but that will break any shell script that is expecting Linux FIND syntax.  |O

After wasting an afternoon debugging such a CMD script that had mysteriously broken since I last used it some 15 month earlier, I ended up replacing all occurrences of find in it with %SystemRoot%\System32\find to explicitly invoke the Windows version!  :horse:
 
The following users thanked this post: PlainName, JohanH

Offline Sherlock Holmes

  • Frequent Contributor
  • **
  • !
  • Posts: 570
  • Country: us
Re: General IDE to learn C++ on
« Reply #101 on: January 12, 2023, 05:30:49 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?

Visual Studio is a superb application though, very very robust, very well maintained, runs on Mac too. The overall robustness, cutting edge extension support and powerful debugging of multithreaded and asynchronous code is just win-win-win.

The community edition is free too!
“When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.” ~ Arthur Conan Doyle, The Case-Book of Sherlock Holmes
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 13125
  • Country: us
Re: General IDE to learn C++ on
« Reply #102 on: January 13, 2023, 02:24:30 am »
Caution: Cigwyn (and also various GCC based toolchains) can break totally unrelated Windows CMD scripts (.bat, .cmd).   The culprit is often the FIND command, which has very different syntax in its Linux and Windows command line versions.   You can reorder the path so the Windows version comes first, but that will break any shell script that is expecting Linux FIND syntax.  |O

After wasting an afternoon debugging such a CMD script that had mysteriously broken since I last used it some 15 month earlier, I ended up replacing all occurrences of find in it with %SystemRoot%\System32\find to explicitly invoke the Windows version!  :horse:

Here is a useful little command script to help with this situation. It reproduces the Unix "which" command by telling you which program will run when you enter a command, for example:
Code: [Select]
C:\Temp>which notepad
C:\Windows\System32\notepad.exe

C:\Temp>which find
C:\Windows\System32\find.exe

C:\Temp>which cl
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\bin\Hostx86\x86\cl.exe

C:\Temp>which perl
C:\Strawberry\perl\bin\perl.exe

C:\Temp>which which
C:\Tools\which.cmd

C:\Temp>

The script is listed below. Place it in a file called "which.cmd" and place it somewhere suitable in your path. I like to use C:\Tools for this kind of thing.
Code: [Select]
:: which.cmd
::
:: Locates which version of a command will run given the current search path
::
@echo off
setlocal enableextensions

set command=%1

if "%command:~0,1%"=="/" (
    echo Finds and prints the location of the program that will execute a given command
    echo given the current search path. Convenient to find out if the expected version
    echo of a command is the one that will run.
    echo.
    echo WHICH [command]
    echo.
    echo For example,
    echo.
    echo     which notepad
    echo.
    echo will likely display
    echo.
    echo   C:\Windows\System32\notepad.exe
    exit /b 0
)

if "%command%"=="" (
    echo Usage: which command
    exit /b 0
)
::
:: Set things up
::
set extlist=%pathext%
set found=false
set localpath=%cd%;%path%

::
:: Loop over all possible command extensions
::
:extloop
if "%extlist%"=="" exit /b 1

call :getnext

call :lookforit %command%%ext%
if %found%==true exit /b 0
goto :extloop

::
:: Subroutine to get next available command extension from list
::
:getnext

for /f "delims=; tokens=1,*" %%i in ("%extlist%") do (
  set ext=%%i
  set extlist=%%j
)

goto :eof

::
:: Subroutine to locate a given command+extension in the search path
::
:lookforit

set fullpath=%~$localpath:1
if "%fullpath%"=="" goto :eof

echo %fullpath%
set found=true
goto :eof
 
The following users thanked this post: orb


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->