Question:
C++ compiler not working?
2011-07-22 23:38:02 UTC
I'm just now starting to learn C++ programming and on the basic task of making the first program. However, I'm stuck on it and I can't find my way out. I've added the compiler to all files, and have saved the code text in WordPad, saved as .cpp file but it doesn't recognize the files existence. I've even downloaded the file from the website (from the book I'm reading) and it didn't help either.
I'm all turned around and have no idea what to do.
Five answers:
Damien Bell
2011-07-23 02:43:36 UTC
All these answers are surprisingly crappy. Not really too surprised about that.



In order to compile using G++ in windows, you should be using a much different syntax than the syntax that you'd be using in a linux / unix environment.



Example:

g++ -g .\Motto.cpp -o Motto -lm



Also, did you add the program path? Did you escape that properly for use with windows? You should consider getting a more modern IDE / more versatile compiler solution that works with windows. Visual C++ Express / netbeans running with cygwin / g++ / make /gdb running on an external terminal is pretty beautiful as well.
Me M
2011-07-23 00:26:11 UTC
Does windows hide the file extension on your computer's files? By default, Windows does hide the file extension.... so when you have a file named filename.txt, Windows will only show filename as the name of the file. When you create a new text file, it usually a txt on to the end automatically. If your file extensions are hidden, your file names may actually be something like Motto.cpp.txt (or some other extension, like rtf).



Since it looks like you are using a windows command line, use the dir command to make sure your Motto.cpp file is in the directory you are in when you run the g++ command.



Also, in the command line, don't put a space between the - and the o.
2011-07-22 23:55:42 UTC
Could you upload the text/screenshot of the error? My best guess is that you're double-clicking those files pretending something to happen... but perhaps I'm wrong.



First, I recommend you to get a good IDE or text editor. Code::Blocks is great.



Second. Buy a real book about C++ programming, and try to read about MSDOS and UNIX too...



BTW, I offer training, if you prefer that way of learning...
casanova
2016-10-15 09:55:42 UTC
you've got the potential to do a sparkling setting up of the two 32 or sixty 4 bit abode windows on there with out subject sixty 4 bit Win 7 demands 2 GB i've got confidence, yet you would be greater advantageous off with 32 bit in the journey that your RAM is basically 3 GB in any case
Andrius
2011-07-23 01:17:50 UTC
I don't think you can use wordpad for coding, also setup path variable in system properties for gcc compiler.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...