 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Brian Guest
|
Posted: Thu Oct 16, 2003 1:53 pm Post subject: 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 FilesMicrosoft Visual Studio
..NETVc7includexstring(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 FilesMicrosoft Visual Studio
..NETVc7includexstring(1286) : error
C2143: syntax error : missing ';' before
'std::basic_string<_Elem,_Traits,_Ax>::
npos'
c:Program FilesMicrosoft Visual Studio
..NETVc7includexstring(1286) : error
C2501: 'std::basic_string<_Elem,_Traits,_Ax>::size_type' : missing
storage-class
or type specifiers
c:Program FilesMicrosoft Visual Studio .NET
2003Vc7includetypeinfo.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 FilesMicrosoft Visual Studio
..NETVc7includexlocinfo.h(4 : error
C2143: syntax error : missing ';' before 'identifier'
c:Program FilesMicrosoft Visual Studio
..NETVc7includexlocinfo.h(4 : warni
ng C4091: 'typedef ' : ignored on left of '_Collvec' when no variable
is declare
d
c:Program FilesMicrosoft Visual Studio
..NETVc7includexlocinfo.h(4 : fatal
error C1004: unexpected end of file found
thanks,
brian
|
|
| Back to top |
|
 |
Unforgiven Guest
|
Posted: Thu Oct 16, 2003 2:27 pm Post subject: Re: compile hello world |
|
|
Brian wrote:
| Quote: | 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?
|
|
| Back to top |
|
 |
Victor Bazarov Guest
|
Posted: Thu Oct 16, 2003 2:29 pm Post subject: Re: compile hello world |
|
|
"Brian" <b1henning (AT) hotmail (DOT) com> wrote...
| Quote: | 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
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
|
|
| Back to top |
|
 |
Allan Bruce Guest
|
Posted: Thu Oct 16, 2003 3:21 pm Post subject: Re: compile hello world |
|
|
"Brian" <b1henning (AT) hotmail (DOT) com> wrote
| Quote: | 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
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
|
|
| Back to top |
|
 |
Allan Bruce Guest
|
Posted: Thu Oct 16, 2003 3:46 pm Post subject: Re: compile hello world |
|
|
| Quote: | 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?
|
|
| Back to top |
|
 |
Gary Labowitz Guest
|
Posted: Thu Oct 16, 2003 3:47 pm Post subject: Re: compile hello world |
|
|
"Allan Bruce" <allanmb (AT) TAKEAWAYf2s (DOT) com> wrote
| Quote: |
"Brian" <b1henning (AT) hotmail (DOT) com> wrote in message
news:3b798b2d.0310160553.3066437d (AT) posting (DOT) 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
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
|
|
| Back to top |
|
 |
James Lothian Guest
|
Posted: Thu Oct 16, 2003 3:47 pm Post subject: Re: compile hello world |
|
|
Allan Bruce wrote:
[snip]
| Quote: |
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
|
|
| Back to top |
|
 |
Unforgiven Guest
|
Posted: Thu Oct 16, 2003 3:56 pm Post subject: Re: compile hello world |
|
|
Allan Bruce wrote:
| Quote: | 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?
|
|
| Back to top |
|
 |
Gary Labowitz Guest
|
Posted: Thu Oct 16, 2003 4:01 pm Post subject: Re: compile hello world |
|
|
"Allan Bruce" <allanmb (AT) TAKEAWAYf2s (DOT) com> wrote
| Quote: | 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
|
|
| Back to top |
|
 |
Faz@nowhere.com Guest
|
Posted: Sun Nov 09, 2003 1:29 am Post subject: Re: compile hello world |
|
|
"Brian" <b1henning (AT) hotmail (DOT) com> wrote
| Quote: | 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
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|