compile hello world



 DEVELOP > c-Plus-Plus > compile hello world

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "Brian"
Date: 16 Oct 2003 08:53:10 AM
Object: compile hello world
Greetings:
I am trying to compile the following code via command line.
It compiles just fine in visual studio 2002 v7 so i took looked at the
properties and i
got the following command line options, but when i try to compile i
get the errors listed
below. Can anyone give me a suggestion on how to compile this program?
#include <iostream>
using namespace std;
int main() {
cout << "Hello World" << endl;
return 0;
}
cl /nologo /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Gm
/EHsc /RTC1 /MLd
/Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /nologo /c /Wp64 /ZI /TP
example.cpp
c:\Program Files\Microsoft Visual Studio
..NET\Vc7\include\xstring(1286) : warnin
g C4346: 'std::basic_string<_Elem,_Traits,_Ax>::size_type' : dependent
name is n
ot a type
prefix with 'typename' to indicate a type
c:\Program Files\Microsoft Visual Studio
..NET\Vc7\include\xstring(1286) : error
C2143: syntax error : missing ';' before
'std::basic_string<_Elem,_Traits,_Ax>::
npos'
c:\Program Files\Microsoft Visual Studio
..NET\Vc7\include\xstring(1286) : error
C2501: 'std::basic_string<_Elem,_Traits,_Ax>::size_type' : missing
storage-class
or type specifiers
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\typeinfo.h(53) :
error C2989: 'type_info' : template class has already been defined as
a non-temp
late class
predefined C++ types (compiler internal)(96) : see declaration
of 'type_
info'
c:\Program Files\Microsoft Visual Studio
..NET\Vc7\include\xlocinfo.h(48) : error
C2143: syntax error : missing ';' before 'identifier'
c:\Program Files\Microsoft Visual Studio
..NET\Vc7\include\xlocinfo.h(48) : warni
ng C4091: 'typedef ' : ignored on left of '_Collvec' when no variable
is declare
d
c:\Program Files\Microsoft Visual Studio
..NET\Vc7\include\xlocinfo.h(48) : fatal
error C1004: unexpected end of file found
thanks,
brian
.

User: ""

Title: Re: compile hello world 08 Nov 2003 07:29:56 PM
"Brian" <b1henning@hotmail.com> wrote in message
news:<3b798b2d.0310160553.3066437d@posting.google.com>...

I am trying to compile the following code via command line.
It compiles just fine in visual studio 2002 v7 so i took looked at the
properties and i

got the following command line options, but when i try to compile i
get the errors listed

below. Can anyone give me a suggestion on how to compile this program?

[gripping list of errors omitted]
There is a batch file provided in the installation called something like
vcvars.bat, if I recall correctly. This sets up the environment variables so
that the standard headers and the libraries can be found by the compiler and
linker. Run that batch file within the console session before executing
your compiler. Maybe that's your problem.. for some weird reason I didn't
get the urge to comb through the errors :-P
Good luck,
Fazl
.

User: "Allan Bruce"

Title: Re: compile hello world 16 Oct 2003 10:21:10 AM
"Brian" <b1henning@hotmail.com> wrote in message
news:3b798b2d.0310160553.3066437d@posting.google.com...

Greetings:
I am trying to compile the following code via command line.
It compiles just fine in visual studio 2002 v7 so i took looked at the
properties and i

got the following command line options, but when i try to compile i
get the errors listed

below. Can anyone give me a suggestion on how to compile this program?

#include <iostream>

using namespace std;

int main() {
cout << "Hello World" << endl;
return 0;
}

In visual studio, endl is not suppported. I usually use ENDL and #define
ENDL "\n"
Allan
.
User: "Gary Labowitz"

Title: Re: compile hello world 16 Oct 2003 10:47:17 AM
"Allan Bruce" <allanmb@TAKEAWAYf2s.com> wrote in message
news:bmmcvd$cnc$1@news.freedom2surf.net...


"Brian" <b1henning@hotmail.com> wrote in message
news:3b798b2d.0310160553.3066437d@posting.google.com...

Greetings:
I am trying to compile the following code via command line.
It compiles just fine in visual studio 2002 v7 so i took looked at the
properties and i

got the following command line options, but when i try to compile i
get the errors listed

below. Can anyone give me a suggestion on how to compile this program?

#include <iostream>

using namespace std;

int main() {
cout << "Hello World" << endl;
return 0;
}


In visual studio, endl is not suppported. I usually use ENDL and #define
ENDL "\n"

Don't be ridiculous. VC++ supports endl just fine.
Newbie alert!! Previous post is in error.
But please take Microsoft compiler questions to the Microsoft newsgroups.
--
Gary
.
User: "Allan Bruce"

Title: Re: compile hello world 16 Oct 2003 10:46:29 AM

In visual studio, endl is not suppported. I usually use ENDL and

#define

ENDL "\n"


Don't be ridiculous. VC++ supports endl just fine.

Newbie alert!! Previous post is in error.
But please take Microsoft compiler questions to the Microsoft newsgroups.

ok, please forgive me, I forgot to use std::endl, since I dont declare to
use a namesapce.
BTW, Which post is in error?
.
User: "Gary Labowitz"

Title: Re: compile hello world 16 Oct 2003 11:01:42 AM
"Allan Bruce" <allanmb@TAKEAWAYf2s.com> wrote in message
news:bmmees$dbs$1@news.freedom2surf.net...

In visual studio, endl is not suppported. I usually use ENDL and

#define

ENDL "\n"

<<snip>>

BTW, Which post is in error?

The one that says : "In visual studio, endl is not suppported."
--
Gary
.



User: "Unforgiven"

Title: Re: compile hello world 16 Oct 2003 10:56:32 AM
Allan Bruce wrote:

In visual studio, endl is not suppported. I usually use ENDL and
#define ENDL "\n"

In addition to the fact that std::endl is supported just fine in all
versions of VC I've ever used, as other posters have already stated, I would
like to add that your macro is NOT equivalent to std::endl.
What std::endl actually does is insert a new line, and flush the buffer. So
your macro would need to be (if it would be needed, which it's not):
#define ENDL "\n" << std::flush
Ah... talk of endl and flush always takes me back to first year at Uni: my
programming course instructor would insist you have to use std::endl instead
of just "\n" in case the computer explodes right after the statement. Yep,
those were his exact words (well, not exactly, he said it in Dutch, but you
get the idea). ^_^
More realistically, I've had situations where a line would not show up if
the program terminated unexpectedly after the std::cout statement if I
didn't use endl or flush.
--
Unforgiven
A: Top Posting!
Q: What is the most annoying thing on Usenet?
.

User: "James Lothian"

Title: Re: compile hello world 16 Oct 2003 10:47:44 AM
Allan Bruce wrote:
[snip]


In visual studio, endl is not suppported. I usually use ENDL and #define
ENDL "\n"
Allan

Eh?? Are you sure about that? I've been using endl for ages with VC++.
Look it
up in MSDN library.
James
.


User: "Victor Bazarov"

Title: Re: compile hello world 16 Oct 2003 09:29:39 AM
"Brian" <b1henning@hotmail.com> wrote...

Greetings:
I am trying to compile the following code via command line.
It compiles just fine in visual studio 2002 v7 so i took looked at the
properties and i

got the following command line options, but when i try to compile i
get the errors listed

below. Can anyone give me a suggestion on how to compile this program?

#include <iostream>

using namespace std;

int main() {
cout << "Hello World" << endl;
return 0;
}

The code is fine. The errors you get are due to either installation
issues or wrong command-line options you're passing to the compiler.
Alas, command-line options of different compilers are off-topic here.
Please ask in microsoft.public.vc.language or some other relevant
VC++ newsgroup.
Victor
.

User: "Unforgiven"

Title: Re: compile hello world 16 Oct 2003 09:27:43 AM
Brian wrote:

Greetings:
I am trying to compile the following code via command line.
It compiles just fine in visual studio 2002 v7 so i took looked at the
properties and i

got the following command line options, but when i try to compile i
get the errors listed

below. Can anyone give me a suggestion on how to compile this program?

This newsgroup covers only the standard C++ language, of which compiler
command line options are not a part. Please consult a newsgroup where your
query is on topic, such as the microsoft.public.* groups.
--
Unforgiven
A: Top Posting!
Q: What is the most annoying thing on Usenet?
.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER