473,790 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error when compiling with Cygwin

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 ?!
Jul 22 '05 #1
22 2222
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.

Jul 22 '05 #2

"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
Jul 22 '05 #3

"TuPLaD" <sp*****@pandor a.be> wrote in message
news:a2******** *************** ***@posting.goo gle.com...
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



Jul 22 '05 #4
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

Jul 22 '05 #5
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

Jul 22 '05 #6
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"
Jul 22 '05 #7

"Rich Grise" <nu**@example.n et> wrote in message
news:ON5Xc.384$ yP4.275@trnddc0 8...
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
Jul 22 '05 #8
jive wrote:

"Rich Grise" <nu**@example.n et> wrote in message
news:ON5Xc.384$ yP4.275@trnddc0 8...
> 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

Jul 22 '05 #9
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 !
Jul 22 '05 #10

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

Similar topics

1
2917
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 some obscure reasons, I have to make all this work in Windows, where I have very little experience. I've installed cygwin and everything is going well using the provided g++ compiler.
12
5649
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: http://www.linuxgazette.com/issue74/tougher.html ServerSoccket.cpp apparently compiles OK. Socket.cpp has a problem. Here's
1
1277
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 ../mht/libmht.a when searching for -lmht /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/bin/ld: skippin g incompatible ../mht/libmht.a when searching for -lmht
1
4677
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 Windows 2000 professional, 1024 or 256 or 512 MB of RAMand 40Gb of disk. Postmaster shows version 7.4.1 Problem:
17
5128
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 timespec tmsp' has incomplete type and cannot b e initialized
1
6761
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)) ) { int max; // number to count to if (argc == 1) { // print to 100
1
2311
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". After several successful compilation, it spat out following error : /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(libcmain.o): (.text+0xab): undefined reference to `_WinMain@16' collect2: ld returned 1 exit status
16
43732
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 error: undefined reference to `_WinMain@16' I have tried searching for a workaround, although I am not a programming guru, and I find it difficult to comprehend the discussions on this topic :) Any help is appreciated.
6
3634
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 -Wold-style-cast - Woverloaded-virtual -o kk kk.cpp it displays the following errors: kk.cpp: In function `void Burp(std::ostream&, std::vector<std::vector<T, std::allocator<_CharT, std::allocator<std::vector<T, std::allocator<_CharT &)':
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9021
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 project—planning, coding, testing, and deployment—without 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
7530
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
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5422
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...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4094
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
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.