public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: Using gcc
@ 2002-03-28 20:40 Mariappan, MaharajanX
  0 siblings, 0 replies; 8+ messages in thread
From: Mariappan, MaharajanX @ 2002-03-28 20:40 UTC (permalink / raw)
  To: 'Francisco Mendez', gcc-help


a simple Hello World program is described,
[File: hello/hello.c]

Is the above line is a part of ur fil? if so remove it or put as the inline
comment like below,
/* [File: hello/hello.c] */


- Maharajan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Using gcc
  2005-12-24 19:40 jjwdeck
@ 2005-12-24 20:00 ` Brian Dessent
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Dessent @ 2005-12-24 20:00 UTC (permalink / raw)
  To: gcc-help

"jjwdeck@juno.com" wrote:

>         Checking the documentation for a version of gcc close to this one gave me now clue as to how to resolve the linker error.  I ended up searching  /usr/lib for __gxx_personality_v0 to find libstdc++.a which so happened to define the reference.  Where do I find documentation that will tell me how to get started doing a compile in this situation?  Also what is this 'personality' type of name the linker needs?

You shouldn't have to specify any of that kind of junk.  It should just
work.  But you didn't include the exact command(s) you used to compile
and link and without that info it's pretty hard to assist you.

The kind of error that you're seeing is often caused by trying to link
by calling 'ld' directly instead of using the 'gcc' command, or trying
to link C++ code by calling 'gcc' instead of 'g++'.  You should always
link with 'gcc', unless you have any C++ code in which case you should
compile and link with 'g++'.  By doing this the necessary internal
library bits will always be added automatically.

Brian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Using gcc
@ 2005-12-24 19:40 jjwdeck
  2005-12-24 20:00 ` Brian Dessent
  0 siblings, 1 reply; 8+ messages in thread
From: jjwdeck @ 2005-12-24 19:40 UTC (permalink / raw)
  To: gcc-help

	It has been a long time since I compiled anything on Linux.  When I attempted to compile the following program with gcc (ver 3.3.4-13 on a Debian’s Sarge).  It resulted in the error below.  

Program:
// test compile
#include	<stdio.h>

int	main(void) {
	printf("Hello World\n") ;
} 

Compiler/Linker error:
/tmp/cc0Ke0PP.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

	Checking the documentation for a version of gcc close to this one gave me now clue as to how to resolve the linker error.  I ended up searching  /usr/lib for __gxx_personality_v0 to find libstdc++.a which so happened to define the reference.  Where do I find documentation that will tell me how to get started doing a compile in this situation?  Also what is this 'personality' type of name the linker needs?  

	Sincerely,
	jjwdeck



___________________________________________________________________
Try Juno Platinum for Free! Then, only $9.95/month!
Unlimited Internet Access with 250MB of Email Storage.
Visit http://www.juno.com/value to sign up today!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: Using gcc
@ 2002-03-28 20:40 Thai Dang Vu
  0 siblings, 0 replies; 8+ messages in thread
From: Thai Dang Vu @ 2002-03-28 20:40 UTC (permalink / raw)
  To: Francisco Mendez, gcc-help


Have you tried 

gcc -g -Wall -o hello hello.c

yet?
Attention: there's a space between -o and hello.

-----Original Message-----
From: Francisco Mendez [mailto:iframe@prodigy.net.mx]
Sent: Friday, March 29, 2002 11:29 AM
To: gcc-help@gcc.gnu.org
Subject: Using gcc


Hi:
I'm totaly new to c programming, I'm using Red Hat 7.2. Recently I got 
the book "Practical C Programming" by Steve Oualline (O'Reilly). In Ch-2

a simple Hello World program is described,
[File: hello/hello.c]
#include <stdio.h>
int main()
{
   printf("Hello World\n");
   return(0);
}

The file is saved as hello.c

, following are the instructions for compiling from the command line:
   gcc -g -Wall -ohello hello.c

The sample fails to compile, unstead I get the following Messages:
hello.c:1: parse error before '['
In file included from usr/include/bits/types.h:143,
                         from usr/include/stdio.h:36,
                         from hello.c:2:
usr/include/bits/pthreadtypes.h:48: parse error before 'size_t'
usr/include/bits/pthreadtypes.h:48: warning: no semicolon at end  of 
structure union
usr/include/bits/pthreadtypes.h:51: parse error before '__stacksize'
usr/include/bits/pthreadtypes.h:51: warning: data definition has no type

or storage class
usr/include/bits/pthreadtypes.h:52: warning: data definition has no type

or storage class
In file included from usr/include/_G_config.h:44;
                         from usr/include/libio.h:32,
                         from usr/include/stdio.h:65,
                         from hello.c:2:
usr/include/gconv.h:72: parse error before 'size_t'
usr/include/gconv.h:85: parse error before 'size_t'
usr/include/gconv.h:94: parse error before 'size_t'
usr/include/gconv.h:170: parse error before 'size_t'
usr/include/gconv.h:170: warning: no semicolon at end of struct or union
usr/include/gconv.h:173: parse error before '}'
usr/include/gconv.h:173: warning: data definition has no type or storage

class
In file included from usr/include/libio.h:32,
                         from usr/include/libio.h:65,
                         from hello.c:2:
usr/include/_G_config.h:47: field '__cd' has incomplete type
usr/include/_G_config.h:50: field '__cd' has incomplete type
usr/include/_G_config.h:53: confused by earlier errors, bailing out

So it seems impossible to compile this simple programm. Whatis wrong?

Any help in this respect will be appreciated. Thanks in advance.

Francisco Mendez.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Using gcc
@ 2002-03-28 20:30 Francisco Mendez
  0 siblings, 0 replies; 8+ messages in thread
From: Francisco Mendez @ 2002-03-28 20:30 UTC (permalink / raw)
  To: gcc-help

Hi:
I'm totaly new to c programming, I'm using Red Hat 7.2. Recently I got 
the book "Practical C Programming" by Steve Oualline (O'Reilly). In Ch-2 
a simple Hello World program is described,
[File: hello/hello.c]
#include <stdio.h>
int main()
{
   printf("Hello World\n");
   return(0);
}

The file is saved as hello.c

, following are the instructions for compiling from the command line:
   gcc -g -Wall -ohello hello.c

The sample fails to compile, unstead I get the following Messages:
hello.c:1: parse error before '['
In file included from usr/include/bits/types.h:143,
                         from usr/include/stdio.h:36,
                         from hello.c:2:
usr/include/bits/pthreadtypes.h:48: parse error before 'size_t'
usr/include/bits/pthreadtypes.h:48: warning: no semicolon at end  of 
structure union
usr/include/bits/pthreadtypes.h:51: parse error before '__stacksize'
usr/include/bits/pthreadtypes.h:51: warning: data definition has no type 
or storage class
usr/include/bits/pthreadtypes.h:52: warning: data definition has no type 
or storage class
In file included from usr/include/_G_config.h:44;
                         from usr/include/libio.h:32,
                         from usr/include/stdio.h:65,
                         from hello.c:2:
usr/include/gconv.h:72: parse error before 'size_t'
usr/include/gconv.h:85: parse error before 'size_t'
usr/include/gconv.h:94: parse error before 'size_t'
usr/include/gconv.h:170: parse error before 'size_t'
usr/include/gconv.h:170: warning: no semicolon at end of struct or union
usr/include/gconv.h:173: parse error before '}'
usr/include/gconv.h:173: warning: data definition has no type or storage 
class
In file included from usr/include/libio.h:32,
                         from usr/include/libio.h:65,
                         from hello.c:2:
usr/include/_G_config.h:47: field '__cd' has incomplete type
usr/include/_G_config.h:50: field '__cd' has incomplete type
usr/include/_G_config.h:53: confused by earlier errors, bailing out

So it seems impossible to compile this simple programm. Whatis wrong?

Any help in this respect will be appreciated. Thanks in advance.

Francisco Mendez.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Using gcc
  2001-09-14  8:39 charles scott
  2001-09-14  9:14 ` Claudio Bley
@ 2001-09-14  9:28 ` 홍근식
  1 sibling, 0 replies; 8+ messages in thread
From: 홍근식 @ 2001-09-14  9:28 UTC (permalink / raw)
  To: cpscott; +Cc: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 821 bytes --]

is ansi C
> Hello,
> 
> I am new to GNU CC and I have version gcc 3.0.1 running on Solaris 8. 
>  The package seemed to install okay and I added the  /usr/local/bin 
> directory to my path however, when I compile my c++ program it returns 
> the following message:
> 
>                     `main' must return `int'  
> 
> Here is the code.
> 
> #include <iostream.h>
> 
> void main()
> {
>        long   number = 0;
>        cout <<  "This is a test. "  <<  number   <<   endl;
> }
> 
> Is there a place where I get some sample c++ code that will compile to 
> test my install?
> 
> Thanks for your assistance.


-- 
°­ÇÏ°í ¾Æ¸§´Ù¿î ¸®´ª½º 
<a href=" http://darkstar.kslp.org" ;> http://darkstar.kslp.org </a>
<a href=" http://kslp.org" ;> http://kslp.org </a>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Using gcc
  2001-09-14  8:39 charles scott
@ 2001-09-14  9:14 ` Claudio Bley
  2001-09-14  9:28 ` 홍근식
  1 sibling, 0 replies; 8+ messages in thread
From: Claudio Bley @ 2001-09-14  9:14 UTC (permalink / raw)
  To: gcc-help

>>>>> " " == charles scott <cpscott@nsu.edu> writes:

     > Hello, I am new to GNU CC and I have version gcc 3.0.1 running on
     > Solaris 8.  The package seemed to install okay and I added the
     > /usr/local/bin directory to my path however, when I compile my c++
     > program it returns the following message:

     >                     `main' must return `int'

     > Here is the code.

     > #include <iostream.h>

     > void main() 
     > { 
     >      long number = 0; 
     >      cout << "This is a test. "  << number << endl;
     > }

     > Is there a place where I get some sample c++ code that will compile
     > to test my install?

     > Thanks for your assistance.

Just do what the compiler suggests/dictates!

#include <iostream>           /* include C++ header files without .h */

int main ()                   /* `main' must return `int' !! */
{
    using namespace std;      /* cout is declared in namespace std */

    long number = 0;
    cout << "This is a test. "  << number << endl;

    return 0;
}


Claudio

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Using gcc
@ 2001-09-14  8:39 charles scott
  2001-09-14  9:14 ` Claudio Bley
  2001-09-14  9:28 ` 홍근식
  0 siblings, 2 replies; 8+ messages in thread
From: charles scott @ 2001-09-14  8:39 UTC (permalink / raw)
  To: gcc-help

Hello,

I am new to GNU CC and I have version gcc 3.0.1 running on Solaris 8. 
 The package seemed to install okay and I added the  /usr/local/bin 
directory to my path however, when I compile my c++ program it returns 
the following message:

                    `main' must return `int'  

Here is the code.

#include <iostream.h>

void main()
{
       long   number = 0;
       cout <<  "This is a test. "  <<  number   <<   endl;
}

Is there a place where I get some sample c++ code that will compile to 
test my install?

Thanks for your assistance.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-12-24 20:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-28 20:40 Using gcc Mariappan, MaharajanX
  -- strict thread matches above, loose matches on Subject: below --
2005-12-24 19:40 jjwdeck
2005-12-24 20:00 ` Brian Dessent
2002-03-28 20:40 Thai Dang Vu
2002-03-28 20:30 Francisco Mendez
2001-09-14  8:39 charles scott
2001-09-14  9:14 ` Claudio Bley
2001-09-14  9:28 ` 홍근식

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).