473,850 Members | 2,073 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\inclu de\xstring(1286 ) : warnin
g C4346: 'std::basic_str ing<_Elem,_Trai ts,_Ax>::size_t ype' : dependent
name is n
ot a type
prefix with 'typename' to indicate a type
c:\Program Files\Microsoft Visual Studio
..NET\Vc7\inclu de\xstring(1286 ) : error
C2143: syntax error : missing ';' before
'std::basic_str ing<_Elem,_Trai ts,_Ax>::
npos'
c:\Program Files\Microsoft Visual Studio
..NET\Vc7\inclu de\xstring(1286 ) : error
C2501: 'std::basic_str ing<_Elem,_Trai ts,_Ax>::size_t ype' : missing
storage-class
or type specifiers
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\includ e\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\inclu de\xlocinfo.h(4 8) : error
C2143: syntax error : missing ';' before 'identifier'
c:\Program Files\Microsoft Visual Studio
..NET\Vc7\inclu de\xlocinfo.h(4 8) : warni
ng C4091: 'typedef ' : ignored on left of '_Collvec' when no variable
is declare
d
c:\Program Files\Microsoft Visual Studio
..NET\Vc7\inclu de\xlocinfo.h(4 8) : fatal
error C1004: unexpected end of file found

thanks,

brian
Jul 19 '05 #1
9 6762
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.publi c.* groups.

--
Unforgiven

A: Top Posting!
Q: What is the most annoying thing on Usenet?

Jul 19 '05 #2
"Brian" <b1*******@hotm ail.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.publi c.vc.language or some other relevant
VC++ newsgroup.

Victor

Jul 19 '05 #3

"Brian" <b1*******@hotm ail.com> wrote in message
news:3b******** *************** ***@posting.goo gle.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
Jul 19 '05 #4
"Allan Bruce" <al*****@TAKEAW AYf2s.com> wrote in message
news:bm******** **@news.freedom 2surf.net...

"Brian" <b1*******@hotm ail.com> wrote in message
news:3b******** *************** ***@posting.goo gle.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
Jul 19 '05 #5
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
Jul 19 '05 #6
> > 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?
Jul 19 '05 #7
"Allan Bruce" <al*****@TAKEAW AYf2s.com> wrote in message
news:bm******** **@news.freedom 2surf.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
Jul 19 '05 #8
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?

Jul 19 '05 #9
Faz
"Brian" <b1*******@hotm ail.com> wrote in message
news:<3b******* *************** ****@posting.go ogle.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

Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1896
by: ping | last post by:
Hello everyone! I had already installed VC6.0 in my computer, then i installed the Vs.net. I wrote some programs of vs.net with the UtraEdit and compiled them in command line. For example, i wrote a program of Hello World with C# language: using System; class MainApp { public static void Main()
10
4797
by: Bart Goeman | last post by:
Hi, I have a question about how to put redundant information in data structures, initialized at compile time. This is often necessary for performance reasons and can't be done at run time (data structures are read only) Ideally one should be able to put the redundant information there automatically so no mistakes are possible, but in a lot of case I see no way how to do it.
12
3314
by: JS | last post by:
I use winXP and have installed Cygwin. I use Dev-C++ and the Cygwin compiler, but for some reason I can't compile this code: #include <setjmp.h> #include <stdio.h> #include <stdlib.h> typedef int othread_t;
0
1062
by: jtbaccarat | last post by:
The sample Hello World app found in .NET Framework SDK\Tutorials\Hello World, will not compile a .exe file. The build.bat file source code is: @ REM Set command switch for building debug or retail (default is to build debug) @ REM Type "build.bat -r" to build for retail @ SET DEBUGSAMPLE=/Zi @ IF "%1"=="-r" SET DEBUGSAMPLE=
7
2025
by: dc | last post by:
Can anybody think of a situation where virtual function's address resolution/ something related to virtual is done at compile time
1
12753
by: 张沈鹏 | last post by:
How to compile the HelloWorld of boost.asio? Maybe this is a stupid problem , but I really don't konw how to find the right way. My compile environment is WinXP, Msys , MinGw , G++ 3.4.2, Boost 1.33.1,
4
10507
by: Susan Rice | last post by:
I'm new to using CString. Why won't the following compile? I'm using Microsoft Visual C++ 6.0 Line 37 which it complains about is the function: 37 CString ConvertFile(char *szFileName) I tried throwing in a bunch of #includes but didn't help. Here's the compiler errors: Compiling...
5
3350
by: ganesh.kundapur | last post by:
Hi, I want to know how to compile the C source file without using the compiler directly. I mean to say by using compiler componets such as ( cpp, cc, as, ld ). I tried to compile the fallowing code as fallows file name: hello.c # include <stdio.h> int main ( void )
2
2559
by: George2 | last post by:
Hello everyone, The compile error of the following code is, foo.cpp(7) : error C2146: syntax error : missing ';' before identifier '_' foo.cpp(7) : error C2065: '_' : undeclared identifier foo.cpp(7) : error C2143: syntax error : missing ';' before 'string'
0
9895
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9744
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11011
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9503
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7900
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5735
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4547
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4142
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3178
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.