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 ?! 22 2165
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.
"Rolf Magnus" <ra******@t-online.de> wrote in message
news:cg*************@news.t-online.com... 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
"TuPLaD" <sp*****@pandora.be> wrote in message
news:a2**************************@posting.google.c om... 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.
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
TuPLaD wrote: Hello, I just made a little C++ console application:
#include "iostream"
This line should be: #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 ?!
--
Will Twentyman
email: wtwentyman at copper dot net
Rolf Magnus wrote: 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
On 25 Aug 2004 05:13:38 -0700, sp*****@pandora.be (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 <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"
"Rich Grise" <nu**@example.net> wrote in message
news:ON5Xc.384$yP4.275@trnddc08... 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
jive wrote: "Rich Grise" <nu**@example.net> wrote in message news:ON5Xc.384$yP4.275@trnddc08... > 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/CatalogueD...CSNUMBER=38110
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 :D
I started it, it gave me the text & stuff :]
Thx for your help all !
Andre Heinen wrote: On 25 Aug 2004 05:13:38 -0700, sp*****@pandora.be (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 <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?
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
TuPLaD wrote: 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/alert...b/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.
"TuPLaD" <sp*****@pandora.be> wrote in message
news:a2**************************@posting.google.c om... 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! :-) 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.
Third -> I just compiled it in Linux, and it worked well :D I started it, it gave me the text & stuff :]
Thx for your help all !
(BTW, was it the include statement that was the problem?)
TuPLaD wrote: First of all -> I didnt knew how to copy paste from Cygwin's window so i made a screenshot
Fair enough, though unusual :-)
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).
Third -> I just compiled it in Linux, and it worked well :D
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?
On Thu, 26 Aug 2004 10:25:37 -0400, Will Twentyman
<wt********@read.my.sig> wrote: Andre Heinen wrote: On 25 Aug 2004 05:13:38 -0700, sp*****@pandora.be (TuPLaD) wrote: #include "iostream"
<snip>
I think that if he used #include "iostream.h" it would work. <snip>
His mistake was to use gcc instead of g++. I have the same
system: when linked correctly, the program works fine with
"iostream". With "iostream.h", it works fine too, but the
compiler gives a warning.
What puzzles me is that I thought it was illegal to use double
quotes to include standard headers. I'd like someone who knows
better than me to confirm.
--
Andre Heinen
My address is "a dot heinen at europeanlink dot com"
jive wrote: "Rolf Magnus" <ra******@t-online.de> wrote in message news:cgk967$soo$00 $1@news.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/CatalogueD...talogueDetail? 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/wg...2004/n1638.pdf outdates the one available on the ISO site.
Could someone comment on that?
- jive
The C++ Committee worked on addressing errors in the original 1998 C++
standard (see this newsgroup's FAQ list about Defect Reports), and is
now working on a future C++ standard.
A Technical Report (TR1) was released containing fixes to Defect
Reports. The TR was folded into a new version of the C++ standard,
dated 2003. That is now the official standard (ISO/IEC 14882:2003). It
is available for purchase from ISO (at the above addres), from www.ansi.org, and from www.incits.org.
In the process of creating a standard (or TR), the committee creates
many drafts, carefully labeled as drafts. The n1638.pdf paper is one
example.
These drafts have no official weight. They are known to contain errors
and inconsistencies, and to be incomplete. In fact these drafts say so
on the first page!
---
Steve Clamage, st*************@sun.com
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:st*****@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
TuPLaD wrote: Hello, I just made a little C++ console application:
#include "iostream"
What is this. this one ought to be
#include <iostream>
using namespace std;
Well, this serves good for academic purposes. But for all practical
purposes, you would not want to bring everything in std namespace to
your application. int main () { cout << "Hello Mars !";
u can write this one as std::cout << ....
return 0;
While your intentions are certainly good when you write this, the
better way to do this is
return EXIT_SUCCESS;
/ EXIT_FAILURE depending upon what you want to do.
}
But when i tryed to compile it with Cygwin.
gcc main.cpp -o main.exe
Why on earth are you using gcc (That is supposed to be a C compiler).
Use g++ . It gave me the following error:
http://users.pandora.be/rz6hkk/cygwin.png
I couldnt access that. I heard there is some new *modern* c++ language ?!
Might be you are talking about a library written in C++.
--
Karthik
Karthiik Kumar wrote: TuPLaD wrote:
Hello, I just made a little C++ console application:
#include "iostream"
What is this. this one ought to be
#include <iostream>
using namespace std;
Well, this serves good for academic purposes. But for all practical purposes, you would not want to bring everything in std namespace to your application.
int main () { cout << "Hello Mars !";
u can write this one as std::cout << ....
return 0;
While your intentions are certainly good when you write this, the better way to do this is
return EXIT_SUCCESS;
/ EXIT_FAILURE depending upon what you want to do.
}
But when i tryed to compile it with Cygwin.
gcc main.cpp -o main.exe
Why on earth are you using gcc (That is supposed to be a C compiler). Use g++ .
Just FYI, gcc is not supposed to be a C compiler. It's rather the
multi-language frontend that tries to guess the language from the file
name of the source file (if you don't explicitly specify it).
The problem is the linking step, since the linker doesn't know the
language that an object file was generated from. Therefore, linking
with gcc assumes C and therefore omits the command line arguments that
would be needed for C++.
However, it's best to not bother and just always use g++ whenever you
have C++ code.
Karthiik Kumar <ka*****************@yahoo.com> wrote in message news:<413018ab$1@darkstar>... TuPLaD wrote:
Hello, I just made a little C++ console application:
#include "iostream"
What is this. this one ought to be
#include <iostream>
using namespace std;
Well, this serves good for academic purposes. But for all practical purposes, you would not want to bring everything in std namespace to your application.
int main () { cout << "Hello Mars !";
u can write this one as std::cout << ....
return 0;
While your intentions are certainly good when you write this, the better way to do this is
return EXIT_SUCCESS;
/ EXIT_FAILURE depending upon what you want to do.
}
But when i tryed to compile it with Cygwin.
gcc main.cpp -o main.exe
Why on earth are you using gcc (That is supposed to be a C compiler). Use g++ .
It gave me the following error:
http://users.pandora.be/rz6hkk/cygwin.png
I couldnt access that.
I heard there is some new *modern* c++ language ?!
Might be you are talking about a library written in C++.
I replaced the image to: http://users.pandora.be/rz6hkk/img/cygwin.png
I compiled it with g++ so it worked.
About the image virusses, well, i didnt had that much virusses, 1 or
2, and some friend of mine changed the source of mydoom a little bit
and gave it to me to "test".
and he didnt had a removal , so had to remove it myself :(
you say its a virus, but why the HELL do you think about it ? look at
the first answer, he clicked on the image, nothing happened ....
whats the problem lol ?
anyway :D
its solved :P
g++ main.cpp -o main.exe worked well in linux , also executed it in
console :) st*************@sun.com (Steve Clamage) writes: jive wrote:"Rolf Magnus" <ra******@t-online.de> wrote in message news:cgk967$soo$00 $1@news.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/CatalogueD...talogueDetail? 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/wg...2004/n1638.pdf outdates the one available on the ISO site. Could someone comment on that? - jive
The C++ Committee worked on addressing errors in the original 1998 C++ standard (see this newsgroup's FAQ list about Defect Reports), and is now working on a future C++ standard.
A Technical Report (TR1) was released containing fixes to Defect
I could've sworn that was called Techical *Corrigendum* 1 ... Am I
wrong?
Reports. The TR was folded into a new version of the C++ standard, dated 2003. That is now the official standard (ISO/IEC 14882:2003). It is available for purchase from ISO (at the above addres), from www.ansi.org, and from www.incits.org.
[snip]
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:st*****@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
llewelly wrote: st*************@sun.com (Steve Clamage) writes:
The C++ Committee worked on addressing errors in the original 1998 C++ standard (see this newsgroup's FAQ list about Defect Reports), and is now working on a future C++ standard.
A Technical Report (TR1) was released containing fixes to Defect
I could've sworn that was called Techical *Corrigendum* 1 ... Am I wrong?
You are correct. I mis-spoke. The correction is TC1, folded into the
2003 version of the standard.
---
Steve Clamage, st*************@sun.com
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:st*****@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Andre Heinen wrote: On Thu, 26 Aug 2004 10:25:37 -0400, Will Twentyman <wt********@read.my.sig> wrote:
Andre Heinen wrote:
On 25 Aug 2004 05:13:38 -0700, sp*****@pandora.be (TuPLaD) wrote:
#include "iostream"
<snip>
I think that if he used #include "iostream.h" it would work. <snip>
His mistake was to use gcc instead of g++. I have the same system: when linked correctly, the program works fine with "iostream". With "iostream.h", it works fine too, but the compiler gives a warning.
What puzzles me is that I thought it was illegal to use double quotes to include standard headers. I'd like someone who knows better than me to confirm.
According to what I've got handy (Stroustrup), double quotes include
from the current directory, <> grabs from the standard include directory
and should not have ".h".
--
Will Twentyman
email: wtwentyman at copper dot net This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: alex |
last post by:
Hello
I have some c++ code, which has been happily developped in the
linux/unix world. Everything has always been compiled with different
compiler (intel, KAI, g++...) and gnu makefiles
For...
|
by: Eugene A |
last post by:
Hello.
I am trying to compile a linux socket server and a client in cygwin on
windows. The g++ version is 3.3.1. The source was obtained from this
location:
...
|
by: user |
last post by:
Cannot see what's wrong.
g++ -O -I../mht -o myfile myfile.o motionModel.o \
-L ../mht -lmht -lm
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/bin/ld:
skippin
g incompatible...
|
by: Janez Kostanj¹ek |
last post by:
Hello everyone,
this is my first post to postgres mailing list.
System that I use:
I am using Postgres under last CygWin published on public mirrors at the moment.
OS system runing is...
|
by: abdur_rab7 |
last post by:
Hi,
I am compiling code for nanosleep in CYGWIN.
During compilation i get the following error
Socket.cc: In method `bool Socket::hangOnConnection(int = 0)':
Socket.cc:338: aggregate `struct...
|
by: edwardzyang |
last post by:
I am running Windows XP with cygwin with gcc 3.4.4-1 and gdb
20060706-2. I compiled this very simple program:
#include <iostream>
using namespace std;
int main(int argc, char (*(argv)) ) {...
|
by: TheOne |
last post by:
I downloaded sample codes from http://www.cs.rpi.edu/~musser/stl-book/source/src.zip
and tried to compile them.
I started my cygwin on xp, renamed Makefile.unix to Makefile and typed
"make"....
|
by: Micko1 |
last post by:
Hello there :)
I have been using Visual Studio on a program which I have just completed, however I need to have it compiling using a unix based compiler, when I try in cygwin, I get the following...
|
by: JR |
last post by:
The code below compiles and runs perfectly in Windows XP Pro, Using MS
VS 2005.
If I compile with g++ (cygwin) using the following command line:
g++ -pedantic -Weffc++ -Wall -Wctor-dtor-privacy ...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |