PDA

View Full Version : C++ Emacs



ah535
December 29th, 2011, 06:14 PM
Hey I am trying to figure out how to do some basic C++ programming. I want to use emacs. My file is saved as hw10.cpp. When I try to compile it this is what I get.


ah535@ah535-laptop:~$ g++ hw10.cpp
hw10.cpp:2:21: error: isostream: No such file or directory
hw10.cpp: In function ‘int main()’:
hw10.cpp:7: error: ‘cout’ was not declared in this scope

This is my code in the emacs window.

#include <isostream>
using namespace std;

int main()
{
cout << "Hello world/n";
return 0;
}


Thanks for the help

Barrucadu
December 29th, 2011, 06:19 PM
Emacs has nothing to do with this - it's "iostream", not "isostream".

dwhitney67
December 29th, 2011, 06:19 PM
Try iostream.

Also, your choice of editor will have no bearing on your ability to learn C++. Thus I recommend that you refrain from mentioning it if you have future posts, since it is not relevant.

MG&TL
December 29th, 2011, 07:52 PM
No disrespect, but Emacs isn't for "hello world" programmers. Although I commend you for getting there. :)

ah535
December 29th, 2011, 09:00 PM
Thanks for the help. That solved it.

F.G.
December 29th, 2011, 09:12 PM
No disrespect, but Emacs isn't for "hello world" programmers. Although I commend you for getting there. :)
when i first tried to learn C i went through a tutorial which mentioned emacs. before i got to write any code i went through trying to learn emacs. finally got a hello world program written, then had to figure out what a 'compiler' was, and where to get one (i was on windows at the time). i'd recommend keeping it simple, and focusing on learning one thing.
(having said that, i've been coding for a few years now, and have only just started to learn vim).