Reputation: 153
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?
Upvotes: 8
Views: 66539
Reputation: 161
Do g++ -Wall helloWorld.cpp -o helloWOrld
... for your example
Upvotes: 7
Reputation: 139
FWIW, gcc is NOT included in Windows by default. You have to install it via MinGW, Cygwin, or some other means.
You can play around with MinGW if you like, but I prefer the gcc compiler provided with Cygwin... it's easier for my simple mind to install. Just install Cygwin and be sure to install gcc as well (it's in the Devel section).
Good luck.
Upvotes: 1
Reputation: 1669
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"
Upvotes: 4
Reputation: 59997
.cpp
is C++ so the command line will start g++ not gccUpvotes: 1