I am trying to use a text editor instead of code::blocks to write some c++ code. Just wrote a "hello world" program.
My code::blocks ide uses the gcc compiler that I installed, but I want to learn how to do it at a bit of a lower level. I read a few tutorials that said all I have to do is open a command prompt and type:
gcc helloWorld.cpp -o helloWOrld
but i get an error saying "gcc" is not a recognized anything.
What do i do to make it work?
GCC is a key component of so-called "GNU Toolchain", for developing applications and writing operating systems. The GNU Toolchain includes: GNU Compiler Collection (GCC): a compiler suite that supports many languages, such as C/C++ and Objective-C/C++.
GCC stands for GNU Compiler Collections which is used to compile mainly C and C++ language. It can also be used to compile Objective C and Objective C++.
gcc is used to compile C program. g++ can compile any . c or . cpp files but they will be treated as C++ files only.
Do g++ -Wall helloWorld.cpp -o helloWOrld
... for your example
If you can compile with code:blocks, than probably it ships out with compiler.
You need to find a path to the compiler (probably somewhere in C:\Program Files\CodeBlocks...) The file name is something like mingw-gcc.exe or mingw-g++.exe I believe also, that you can find this path in IDE settings.
When you know the path and filename, just add the path to the system PATH variable and call gccfilename.exe
to compile c++ programms run g++filename.exe
Also you can run simple compilation without modifying PATH: just run "c:\Full path to compiler\compiler.exe"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With