Im trying to install the C compiler onto my Windows 10 machine to be able to learn to develop in C. After looking around I found this mirror page linked by this official looking site, and downloaded and uncompressed the folder. I also tried git cloneing linked from this page.
After looking at online tutorials most of them install third-party package managers to then install gcc from there, but I'd rather just install it directly (if thats possible in the first place). I'm not really sure if there is a single true C compiler because of this.
This more or less leads to the answer to "How to install it?"
The selection and indirectly the way to install it, is most wisely based on asking your friends/colleagues/fellows, because you will have questions and they are primarily best answered by any human you can directly ask. StackOverflow is only second place.
If that does not help you selecting one, I recommend to use yoru favorite search engine on "install gcc". In mine, the 10th result is my favorite.
Maybe go one step further towards "convenient" and search for "free IDE C" my favorite is the 6th result.
But of course this is not to tell you my favorite in a hidden way. You just look at the results, check the first few out and decide based on what you like best.
There's no official C compiler on any platform, and gcc is not a Windows program. The two main toolkits which provide C a compiler on Windows are MinGW and Cygwin. Both include a port of gcc, and after installing either one, you can use the gcc command to compile your C code.
Microsoft does not make a C compiler. They produce Visual Studio, which contains a C++ compiler that will compile a large subset of C programs, but they have made it clear that they have no intention of keeping up with the latest C standards.
Get the latest version of MinGW-w64 via MSYS2, which provides up-to-date native builds of GCC, MinGW-w64, and other helpful C++ tools and libraries. This will provide you with the necessary tools to compile your code, debug it, and configure it to work with IntelliSense.
In the wizard, choose your desired Installation Folder. Record this directory for later. In most cases, the recommended directory is acceptable. The same applies when you get to setting the start menu shortcuts step. When complete, ensure the Run MSYS2 now box is checked and select Finish. This will open a MSYS2 terminal window for you.
The "code ." command opens VS Code in the current working folder, which becomes your "workspace". Accept the Workspace Trust dialog by selecting Yes, I trust the authors since this is a folder you created.
You can also enable Auto Save to automatically save your file changes, by selecting File > Auto Save. You can find out more about the other views in the VS Code User Interface documentation.
To see IntelliSense in action,hover over vector or string to see their type information. If you type msg. in line 10, you can see a completion list of recommended member functions to call, all generated by IntelliSense:
Remember, the C++ extension uses the C++ compiler you have installed on your machine to build your program. Make sure you have completed the "Installing the MinGW-w64 toolchain" step before attempting to run and debug helloworld.cpp in VS Code.
From now on, the play button will read from tasks.json to figure out how to build and run your program. You can define multiple build tasks in tasks.json, and whichever task is marked as the default will be used by the play button. In case you need to change the default compiler, you can run Tasks: Configure Default Build Task in the Command Palette. Alternatively you can modify the tasks.json file and remove the default by replacing this segment:
This will advance program execution to the first line of the for loop, and skip over all the internal function calls within the vector and string classes that are invoked when the msg variable is created and initialized. Notice the change in the Variables window on the left.
In this case, the errors are expected because, although the variable names for the loop are now visible to the debugger, the statement has not executed yet, so there is nothing to read at this point. The contents of msg are visible, however, because that statement has completed.
Press Step over again to advance to the next statement in this program (skipping over all the internal code that is executed to initialize the loop). Now, the Variables window shows information about the loop variables.
If you like, you can keep pressing Step over until all the words in the vector have been printed to the console. But if you are curious, try pressing the Step Into button to step through source code in the C++ standard library!
To return to your own code, one way is to keep pressing Step over. Another way is to set a breakpoint in your code by switching to the helloworld.cpp tab in the code editor, putting the insertion point somewhere on the cout statement inside the loop, and pressing F9. A red dot appears in the gutter on the left to indicate that a breakpoint has been set on this line.
Place the insertion point inside the loop. In the Watch window, select the plus sign and in the text box, type word, which is the name of the loop variable. Now view the Watch window as you step through the loop.
There are cases where you'd want to customize your debug configuration, such as specifying arguments to pass to the program at runtime. You can define custom debug configurations in a launch.json file.
In the JSON above, program specifies the program you want to debug. Here it is set to the active file folder ($fileDirname) and active filename with the .exe extension ($fileBasenameNoExtension.exe), which if helloworld.cpp is the active file will be helloworld.exe. The args property is an array of arguments to pass to the program at runtime.
The extension uses the compilerPath setting to infer the path to the C++ standard library header files. When the extension knows where to find those files, it can provide features like smart completions and Go to Definition navigation.
Hello all pls i have the exact same problem but when i search for gcc in yast it shows it ticked meaning it has been installed but i still get the gcc errors and the make error i really dnt know wat to do and im really frustrated pls help anyone someone i just installed suse 11.1 and i cant even find anything on the dvd.
Dninja wrote:
> Hello all pls i have the exact same problem but when i search for gcc in
> yast it shows it ticked meaning it has been installed but i still get
> the gcc errors and the make error i really dnt know wat to do and im
> really frustrated pls help anyone someone i just installed suse 11.1 and
> i cant even find anything on the dvd.
Had the same difficulty while using GNOME live DVD (12.3) and without internet access I could not make gcc run.
I have tried the above mentioned commands and yast but since gcc was lacking dependancies I could not make it running.
In case that somebody has a similar problem just connect to the internet and run yast eventually from Activities menu pick System tools -> Install / Remove Software. Filter the results by gcc or C++, tick a few gcc packets and in the right lower corner click apply or install. This should be enough and I hope it saves you some time.
Setting the compiler version in the project as you have done will cause CCS to use that compiler when it does the build as long as it knows where to find that compiler, otherwise it will use the closest match it can find.
I would check what include paths you have setup. For the include path that pulls in the header files that are part of the compiler (so that it matches the runtime library) we setup that path with a macro. It will be $CG_TOOL_ROOT/include. Then during the build we use the location of the compiler the project is set to use to populate the macro. The path you have circled does not look correct and may have been modified. Here is a screen shot of where to go to check the option.
It worries me that your include path is resolving to C:/ti/ccsv7/tools/compiler/include. To me that means that the compilers were somehow directly installed in C:/ti/ccsv7/tools/compiler. If that is the case this means that in reality you only have 1 as the second install would have overwritten most of the files of the first.
Then go and install the 2 compilers you need. They need to be in different folders. If they are installed in the default locations CCS will find them automatically. if you put them in a custom folder then go back to the dialog above and add the paths to where they are and click refresh.
I have the compilers installed correctly. I deleted the compiler folder from the C:\ti\ccsv7\tools\compiler folder and re-installed both compilers here. CCS is still showing only one available option.
I am having an issue with CCS (version 12.1.0.00007, though I don't think it is the version itself). I recently downloaded, installed, and set up CCS, and imported my project over. I tried to build it, but it cam back with 1 error reading
"This project was created using a version of compiler that is not currently installed - 4.4.8 [MSP430]. See 'Help > Install New Software' and select 'Code Generation Tools Updates' to check if this compiler is available through a CCS update. Visit CCS App Center to get the lastest compiler support. Or download and install the compiler, then register it with CSS through 'Preferences > CCS > Build > Compilers'."
3a8082e126