Now that you understand how it can be easy to start with writing C code, let’s talk about the difficult part… Just go into the directory where your executable is and run it by writing “helloworld.exe” This will generate an executable binary file called helloworld.exe which can be used to run your code Write the following line of code into your terminal: gcc helloworld.c -o helloworld Once installed on your machine, gcc is just a piece of cake to use to compile a simple c language code Step 1: Write your c codeįor example, let’s take this Hello World example #include Now, for large pieces of software, visual studio is probably the way to go 2- How to use the gcc compiler? Building even a very simple project takes much more time than it shouldīecause of that, I find that I kind of takes out the fun of programming and seeing immediately the result of what you did….It’s a big pain to set up the first time.It is huge to download and install (between 10 and 20 GB if I remember).I am personally not such a big fan of Visual Studio because of the following reasons: That’s true, and it’s totally fine if you want to use it… If you are on Windows, you probably heard about software such as visual studio from Microsoft which also you to write and compile C and C++ code as well. for Fortran, the compiler is called gfortran.There are actually several compilers which go together like a suite: The most well know compiler for C language is the GNU compiler called GCC. If you want a simple way to create programs based on C, C++, Fortran, etc… you will have to install a software with can compile the code you write into code that the machine understands Note: The procedure I describe here will not only allow you to install gcc, but also g++, gfortran, and many other useful tools that you usually only get in linux OS (like ls or grep) 1- What I want to teach you here Here’s a video in which I explain the procedure: I have been struggling with how to do the same thing on Windows 10 for some time, but I finally succeeded On Linux, gcc is install by default and you can start to compile and execute C language code almost right away!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |