From: Jad Saklawi <Jad@Saklawi.info>
To: srg <srgqwerty@telefonica.net>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: c++ compiling problem. undefined reference to main
Date: Tue, 06 Apr 2004 23:55:40 +0300 [thread overview]
Message-ID: <4073194C.2000506@Saklawi.info> (raw)
In-Reply-To: <407316A0.1060708@telefonica.net>
srg wrote:
> Hello:
>
> We have a problem compiling c++ code.
> At the bottom of this message you can see the compiler error.
>
> [..]
> # g++ -o cj_enteros cj_enteros.cpp
> /usr/lib/gcc-lib/i486-linux/3.3.3/../../../crt1.o(.text+0x18): In
> function `_start':
> ../sysdeps/i386/elf/start.S:98: undefined reference to `main'
> collect2: ld returned 1 exit status
Yes, your code cj_enteros.cpp doesn`t have a main function. To compile
it do g++ -c cj_entros.cpp you will get cj_entros.o. To link to
hello.cpp use g++ cj_entros.o hello.c -o youroutput
Greets,
Jad
next prev parent reply other threads:[~2004-04-06 20:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-06 20:44 c++ compiling problem. undefined reference to main srg
2004-04-06 20:55 ` Jad Saklawi [this message]
2004-04-08 5:41 ` How to execute a process in background by exec functions? Wen Guangcheng
2004-04-08 8:56 ` Glynn Clements
2004-04-08 13:25 ` John T. Williams
-- strict thread matches above, loose matches on Subject: below --
2004-04-06 21:09 c++ compiling problem. undefined reference to main Sandro Dangui
2004-04-06 21:13 Huber, George K RDECOM CERDEC STCD SRI
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4073194C.2000506@Saklawi.info \
--to=jad@saklawi.info \
--cc=linux-c-programming@vger.kernel.org \
--cc=srgqwerty@telefonica.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.