C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Error when compiling with Cygwin
Goto page 1, 2  Next
 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
TuPLaD
Guest





PostPosted: Wed Aug 25, 2004 12:13 pm    Post subject: Error when compiling with Cygwin Reply with quote



Hello,
I just made a little C++ console application:

#include "iostream"
using namespace std;

int main ()
{
cout << "Hello Mars !";
return 0;
}

But when i tryed to compile it with Cygwin.

gcc main.cpp -o main.exe

It gave me the following error:

http://users.pandora.be/rz6hkk/cygwin.png

I heard there is some new *modern* c++ language ?!
Back to top
Rolf Magnus
Guest





PostPosted: Wed Aug 25, 2004 12:48 pm    Post subject: Re: Error when compiling with Cygwin Reply with quote



TuPLaD wrote:

Quote:
Hello,
I just made a little C++ console application:

#include "iostream"
using namespace std;

int main ()
{
cout << "Hello Mars !";
return 0;
}

But when i tryed to compile it with Cygwin.

gcc main.cpp -o main.exe

If you want to compile and link C++ code, use g++, not gcc. Since you
seem to be using windows, the name might be different (AFAIK, Windows
doesn't support '+' as part of file names).

Quote:
It gave me the following error:

http://users.pandora.be/rz6hkk/cygwin.png

You made a screenshot of your compiler output!? Why not just paste it
into the message?

Quote:
I heard there is some new *modern* c++ language ?!

The last C++ standard version is from 2003, but except for a few minor
corrections, it's the same as C++98.


Back to top
Sharad Kala
Guest





PostPosted: Wed Aug 25, 2004 1:21 pm    Post subject: Re: Error when compiling with Cygwin Reply with quote




"Rolf Magnus" <ramagnus (AT) t-online (DOT) de> wrote

Quote:
TuPLaD wrote:


If you want to compile and link C++ code, use g++, not gcc. Since you
seem to be using windows, the name might be different (AFAIK, Windows
doesn't support '+' as part of file names).

The name is g++ on Windows too.

-Sharad



Back to top
Howard
Guest





PostPosted: Wed Aug 25, 2004 5:32 pm    Post subject: Re: Error when compiling with Cygwin Reply with quote


"TuPLaD" <spawnxx (AT) pandora (DOT) be> wrote

Quote:
Hello,
I just made a little C++ console application:

#include "iostream"
using namespace std;

int main ()
{
cout << "Hello Mars !";
return 0;
}

But when i tryed to compile it with Cygwin.

gcc main.cpp -o main.exe

It gave me the following error:

http://users.pandora.be/rz6hkk/cygwin.png

No way am I clicking on a link like that...who knows what kind of virus I

might download!

If you've got a compiler error, either copy&paste it here, or at least tell
us what it says.

Quote:
I heard there is some new *modern* c++ language ?!

As opposed to what, the "ancient" C++ language? And what would it have to
do with the problem? Surely no change has been made to C++ that would cause
such simple code to fail when it used to work.

(By the way, the usual method of including standard headers is to enclose
the name in <> brackets, not "" quotes. I believe that using the brackets
causes the compiler to search for those headers differently than when using
quotes. No idea if that's your problem, though, because I don't know what
error message you're getting.)

-Howard








Back to top
Will Twentyman
Guest





PostPosted: Wed Aug 25, 2004 7:26 pm    Post subject: Re: Error when compiling with Cygwin Reply with quote

TuPLaD wrote:

Quote:
Hello,
I just made a little C++ console application:

#include "iostream"

This line should be: #include <iostream>

Quote:
using namespace std;

int main ()
{
cout << "Hello Mars !";
return 0;
}

But when i tryed to compile it with Cygwin.

gcc main.cpp -o main.exe

It gave me the following error:

http://users.pandora.be/rz6hkk/cygwin.png

I heard there is some new *modern* c++ language ?!


--
Will Twentyman
email: wtwentyman at copper dot net


Back to top
Rich Grise
Guest





PostPosted: Wed Aug 25, 2004 7:30 pm    Post subject: Re: Error when compiling with Cygwin Reply with quote

Rolf Magnus wrote:

Quote:
TuPLaD wrote:

Hello,
I just made a little C++ console application:

#include "iostream"
using namespace std;

int main ()
{
cout << "Hello Mars !";
return 0;
}

But when i tryed to compile it with Cygwin.

gcc main.cpp -o main.exe

If you want to compile and link C++ code, use g++, not gcc. Since you
seem to be using windows, the name might be different (AFAIK, Windows
doesn't support '+' as part of file names).

It gave me the following error:

http://users.pandora.be/rz6hkk/cygwin.png

You made a screenshot of your compiler output!? Why not just paste it
into the message?

I heard there is some new *modern* c++ language ?!

The last C++ standard version is from 2003, but except for a few minor
corrections, it's the same as C++98.

He can hit alt-prtsc, but he doesn't know how to copy/paste from a
command prompt applet. I wonder if 2> works in cmd?

Cheers!
Rich


Back to top
Andre Heinen
Guest





PostPosted: Thu Aug 26, 2004 8:24 am    Post subject: Re: Error when compiling with Cygwin Reply with quote

On 25 Aug 2004 05:13:38 -0700, [email]spawnxx (AT) pandora (DOT) be[/email] (TuPLaD) wrote:
Quote:
#include "iostream"

I was about to post to tell the OP to use #include <iostream>
instead of #include "iostream", but after I saw that neither Rolf
nor Sharad reacted, I hesitated. I tried it, and indeed my
compiler didn't complain. Yet I was under the impression that
standard headers should be included with square brackets.

Stroustrup 9.2.1 says that for standard headers square brackets
should be used rather than quotes, but I couldn't figure out if
it is mandatory or just some guideline.

If I remember correctly, #include "somefile.h" means:
1) first search for somefile.h in the current directory, and if
that fails
2) search the system directories.
This would explain why my compiler accepted it.

However, #include <iostream> does not mean that there must be a
file called iostream: the name may be different, or there may be
no file at all, depending on the compiler.

Hence I believe that #include "iostream" may work on one
compiler, but is not portable, and should be avoided.

Did I miss something?

--
Andre Heinen
My address is "a dot heinen at europeanlink dot com"

Back to top
jive
Guest





PostPosted: Thu Aug 26, 2004 8:27 am    Post subject: Re: Error when compiling with Cygwin Reply with quote


"Rich Grise" <null (AT) example (DOT) net> wrote

Quote:

The last C++ standard version is from 2003, but except for a few minor
corrections, it's the same as C++98.

AFAIK there is only a draft, as the standardisation process is still
incomplete and new revision of the C++ standard is supposedly due this fall.

- jive



Back to top
Rolf Magnus
Guest





PostPosted: Thu Aug 26, 2004 9:06 am    Post subject: Re: Error when compiling with Cygwin Reply with quote

jive wrote:

Quote:

"Rich Grise" <null (AT) example (DOT) net> wrote in message
news:ON5Xc.384$yP4.275 (AT) trnddc08 (DOT) ..

The last C++ standard version is from 2003, but except for a few
minor corrections, it's the same as C++98.

AFAIK there is only a draft, as the standardisation process is still
incomplete and new revision of the C++ standard is supposedly due this
fall.

See:
http://www.iso.org/iso/en/CatalogueDetailPage.CatalogueDetail?CSNUMBER=38110


Back to top
TuPLaD
Guest





PostPosted: Thu Aug 26, 2004 2:04 pm    Post subject: Re: Error when compiling with Cygwin Reply with quote

First of all ->
I didnt knew how to copy paste from Cygwin's window so i made a
screenshot
2) THERE DOESNT EXIST ANY ANY ANY ANY image virusses that can work
from a site, you will have to download & start it(yes it can go to
cache :]). So its not a virus.

Third -> I just compiled it in Linux, and it worked well Very Happy
I started it, it gave me the text & stuff :]

Thx for your help all !
Back to top
Will Twentyman
Guest





PostPosted: Thu Aug 26, 2004 2:25 pm    Post subject: Re: Error when compiling with Cygwin Reply with quote

Andre Heinen wrote:

Quote:
On 25 Aug 2004 05:13:38 -0700, [email]spawnxx (AT) pandora (DOT) be[/email] (TuPLaD) wrote:

#include "iostream"


I was about to post to tell the OP to use #include <iostream
instead of #include "iostream", but after I saw that neither Rolf
nor Sharad reacted, I hesitated. I tried it, and indeed my
compiler didn't complain. Yet I was under the impression that
standard headers should be included with square brackets.

Stroustrup 9.2.1 says that for standard headers square brackets
should be used rather than quotes, but I couldn't figure out if
it is mandatory or just some guideline.

If I remember correctly, #include "somefile.h" means:
1) first search for somefile.h in the current directory, and if
that fails
2) search the system directories.
This would explain why my compiler accepted it.

However, #include file called iostream: the name may be different, or there may be
no file at all, depending on the compiler.

Hence I believe that #include "iostream" may work on one
compiler, but is not portable, and should be avoided.

Did I miss something?

I think that if he used #include "iostream.h" it would work.

Based on the error messages, it looks like iostream didn't get loaded,
but the complaint from the compiler comes when he tries to use something
from iostream that hasn't loaded, specifically std::cout. I've gotten
similar types of errors in the past from this type of mistake,
especially when I mis-spell a filename.

--
Will Twentyman
email: wtwentyman at copper dot net


Back to top
Pete Chapman
Guest





PostPosted: Thu Aug 26, 2004 2:31 pm    Post subject: OT: Re: Error when compiling with Cygwin Reply with quote

TuPLaD wrote:
Quote:
2) THERE DOESNT EXIST ANY ANY ANY ANY image virusses that can work
from a site, you will have to download & start it(yes it can go to
cache :]). So its not a virus.

Just FYI, it's quite possible have arbitrary code executed just by
loading an image. Take a look at:
http://www.securitytracker.com/alerts/2004/Feb/1009067.html
That's just one (out-of-date) example. Granted, it's an exploit not a
virus. But there's no reason that you couldn't put a virus inside a BMP.

Back to top
Howard
Guest





PostPosted: Thu Aug 26, 2004 2:41 pm    Post subject: Re: Error when compiling with Cygwin Reply with quote


"TuPLaD" <spawnxx (AT) pandora (DOT) be> wrote

Quote:
First of all -
I didnt knew how to copy paste from Cygwin's window so i made a
screenshot
2) THERE DOESNT EXIST ANY ANY ANY ANY image virusses that can work
from a site, you will have to download & start it(yes it can go to
cache :]). So its not a virus.


You obviously don't live in the MS Windows world! Smile Windows has been
well-known for allowing viruses in simply by clicking on a link. And the
link shown in the text doesn't always match the actual underlying link
(because HTML can hide it easily), so just because you have a .png extension
(whatever that is), doesn't mean it's not something that can execute when I
link to it. Check any of the dozen or more security notices about Windows
in the past year. I got a virus on my PC just a month or two ago, simply by
linking to a web site that had been compromised, and that was a site I
normally trust and have linked to many times! Basically, my philosophy
(like many Windows users') is to not click on links unless I know what I'm
linking to.

Quote:
Third -> I just compiled it in Linux, and it worked well Very Happy
I started it, it gave me the text & stuff :]

Thx for your help all !

(BTW, was it the include statement that was the problem?)



Back to top
Rolf Magnus
Guest





PostPosted: Thu Aug 26, 2004 4:24 pm    Post subject: Re: Error when compiling with Cygwin Reply with quote

TuPLaD wrote:

Quote:
First of all -
I didnt knew how to copy paste from Cygwin's window so i made a
screenshot

Fair enough, though unusual :-)

Quote:
2) THERE DOESNT EXIST ANY ANY ANY ANY image virusses that can work
from a site, you will have to download & start it(yes it can go to
cache :]). So its not a virus.

The fact that its name ends in .png alone doesn't mean it's just an
image. That depends on the mimetype that the http server sends. It
could easily be a html page with javascript and activex and (insert web
buzzword here).

Quote:
Third -> I just compiled it in Linux, and it worked well Very Happy

But surely not with the command line you wrote in your original message.
If you use gcc for it, the C++ standard library will not be linked in,
which should result (and does here on my linux box) in similar messages
to those from your screenshot.
Try (as I already wrote) g++ instead of gcc. Do you get the same errors
when using g++ under Cygwin?


Back to top
jive
Guest





PostPosted: Thu Aug 26, 2004 5:42 pm    Post subject: Re: Error when compiling with Cygwin Reply with quote

Quote:
"Rolf Magnus" <ramagnus (AT) t-online (DOT) de> wrote

$1 (AT) news (DOT) t-online.com...
jive wrote:

The last C++ standard version is from 2003, but except for a few
minor corrections, it's the same as C++98.

AFAIK there is only a draft, as the standardisation process is still
incomplete and new revision of the C++ standard is supposedly due this
fall.

See:
http://www.iso.org/iso/en/CatalogueDetailPage.CatalogueDetail?
CSNUMBER=38110

Strange.. I found no mention about this on
http://www.open-std.org/jtc1/sc22/wg21/ and this
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1638.pdf outdates
the one available on the ISO site.

Could someone comment on that?

- jive


---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]


Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.