LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-27-2003, 10:06 PM   #1
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Rep: Reputation: 30
Question hello world in emacs


Hi everyone!!
I was trying to do a "Hello World" C++ program in emacs but I have a little problem:

The Hello World code is:

#include <iostream.h>
int main()
{

cout << " Hello World " << endl;
return(0);

}

and when I compile appear me alot of error and warnings but when I compile in to M$ Visual C++ works fine.

I made a calculator in emacs and works fine I don't know what I made wrong!! Thanks for Answers!!

-----------Gerardo
 
Old 05-27-2003, 10:37 PM   #2
awdoyle
Member
 
Registered: Aug 2002
Location: Portland, OR
Distribution: Xubuntu
Posts: 135

Rep: Reputation: 15
Don't know what's not working, but this might help as an additional reference:
http://99-bottles-of-beer.ls-la.net/
 
Old 05-27-2003, 10:51 PM   #3
moeminhtun
Member
 
Registered: Dec 2002
Location: Singapore
Distribution: Fedora Core 6
Posts: 647

Rep: Reputation: 30
I think it would only give a lot of warning messages, not error messages. You should be able to compile and it should work.
These warning messages come out because you are using the old library. Try this code and should be ok.
Using the new library "iostream", without ".h".

the code is:

#include <iostream>
using namespace std;

int main()
{

cout << " Hello World " << endl;
return(0);

}
 
Old 05-27-2003, 11:13 PM   #4
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Original Poster
Rep: Reputation: 30
Hi moeminhtun!!

I tryed to use the new library and always give the a lot of warnings and just 1 error you have reason, but always give me troubles works with emacs, when I do whatever program always give me warnings and errors I dont know why? Thanks a Lot..

The Errors are:

hello.cpp:1: error de decodificación antes de `for'
hello.cpp:1:36: falta carácter terminando '
hello.cpp:1:36: aviso: constante de carácter demasiado larga
hello.cpp:2: error de decodificación antes de `to'
hello.cpp:3: error de decodificación antes de `text'
hello.cpp:3:36: falta carácter terminando '
hello.cpp:3:36: aviso: constante de carácter demasiado larga
En el fichero incluído de /usr/include/c++/3.2/backward/iostream.h:31,
de hello.cpp:5:
/usr/include/c++/3.2/backward/backward_warning.h:32:2: aviso: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use
-Wno-deprecated.
En el fichero incluído de /usr/include/c++/3.2/iosfwd:45,
de /usr/include/c++/3.2/ios:44,
de /usr/include/c++/3.2/ostream:45,
de /usr/include/c++/3.2/iostream:45,
de /usr/include/c++/3.2/backward/iostream.h:32,
de hello.cpp:5:
/usr/include/c++/3.2/bits/stringfwd.h:51: `char_traits' no es una plantilla
/usr/include/c++/3.2/bits/stringfwd.h:53: `char_traits' no es una plantilla
/usr/include/c++/3.2/bits/stringfwd.h:59: error de decodificación antes del
elemento `<'
/usr/include/c++/3.2/bits/stringfwd.h:63: error sintáctico antes del elemento
`;'
/usr/include/c++/3.2/bits/stringfwd.h:64: error sintáctico antes del elemento
`;'
En el fichero incluído de /usr/include/c++/3.2/cstddef:48,
de /usr/include/c++/3.2/cstdio:50,
de /usr/include/c++/3.2/i386-redhat-linux/bits/c++io.h:35,
de /usr/include/c++/3.2/bits/fpos.h:44,
de /usr/include/c++/3.2/iosfwd:46,
de /usr/include/c++/3.2/ios:44,
de /usr/include/c++/3.2/ostream:45,
de /usr/include/c++/3.2/iostream:45,
de /usr/include/c++/3.2/backward/iostream.h:32,
de hello.cpp:5:
/usr/lib/gcc-lib/i386-redhat-linux/3.2/include/stddef.h:147: redeclaración en
plantilla de `typedef int ptrdiff_t'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/include/stddef.h:147: confusión por errores previos, saliendo

Thanks slightcrazed!!!

------------ Gerardo,
_________________________________
Linux Fast, Stable, Flexible

Last edited by Gerardoj; 05-27-2003 at 11:14 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
where is the .emacs file in the emacs source code tarball? aizkorri Programming 2 01-13-2007 02:05 PM
emacs not responding to .emacs file in Mandriva 2005 LE. Please help LaptopLinux Mandriva 1 06-08-2005 08:36 AM
A whole new world 8oluf7 LinuxQuestions.org Member Intro 2 01-08-2005 06:36 AM
edb (emacs database) won't open file - emacs 20 & 21 tip184 Linux - Software 0 04-03-2004 07:31 AM
world writeable files will not stay world writeable antken Mandriva 1 03-02-2004 05:04 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration