> I copied the code below into my new file where the gcc 4.8.1 is.
Don't do that; you may inadvertently do something that breaks GCC.
Do not write anything into the installation directory C:\GCC_4_8_1 or any of the directories under it.
For each of your new programs, create a fresh directory. For instance, c:\learn_c\console_clrs for this program.
> I tried to compile it with the following which I cut and pasted and amended from number 5. Above.
> gcc -std=c11 -Wall -Wextra -pedantic-errors -c cur_con.c
Each time you open a new command window, before you try to compile anything, first type C:\GCC_4_8_1\MinGW\set_distro_paths.bat at the command prompt.
You need to do this only once, right at the beginning.
>then tried to compile it using gcc cur_con.c -o cur_con and then I get a really weird message
> c:\users\RODNEY~1\AppData\Local1\Temp\cc3o17Le.o:cur_con.c:<.text+0x2df>: undefined reference to sleep'
Compile with gcc -std=c11 -Wall -Wextra -pedantic-errors cur_con.c
Note: omit -c, you want to compile and link.
You would get an error: error: implicit declaration of function 'sleep'
Fix the error (change 'sleep' to 'Sleep' with an upper case 'S'), recompile.
You would get a few warnings about unused variables. (Ideally you should fix these by removing the variables that you never use.)
Run the program to test it.
Still have a problem I ran it exactly as your instructions and when I tried to test I typed cur_con in the command prompt and got cur_con is not recognised as an internal or external command,operable programor batch file.
I compiled the code as instructed, and got the warning messages as you said I would.
I Noticed That in the text editor when I save the code the sleep, if, int etc don't change colour like they used to
Then, copy just the executable (my_program.exe in the above example) to the flash drive, and you can run it on other windows machines.
> 3. Before I compile each time do I first enter at the command line the following
Do it just once when you first open the command window. It adds the directory containing the compiler and other tools required to build the program to the PATH environment variable. https://en.wikipedia.org/wiki/PATH_(variable)
Once you have done that, you can compile as many times as you want, till you close the command window.