My program is about several thousands lines. It takes arguements from
the command line.
If no arguement is given, it should simply exist. Below is the
architectureof main() :
int main(int argc, char *argv[])
{
if( argc == 1 )
{
cout << "NO ARGUEMENT"<<endl;
exit(0);
}
//Other parts of the code
return 0; //LastLine
}
It also links with other libraries.
If no arguement is given on command line, it only outputs "NO
ARGUEMENT", then hangs there.
The exit(0) can not exit. Why exit(0) fails to exit from main()?
If I give correct arguements at command line, the program also hangs.
The return 0 at the LastLine can not exit, either.
The code links some C++ libraries. It only hangs on AIX systems. But
for Linux, it works fine. Why?
I find that maybe a C++ library causes the problem. What should I do?
I have to link that library. Otherwise, the linker complains
"Undefined symbols", although some symbols are not needed in my code,
but they are used in other libraries.
Thanks.
|
|
0
|
|
|
|
Reply
|
junw2000 (221)
|
1/21/2008 12:19:27 AM |
|
junw2000@gmail.com wrote:
> My program is about several thousands lines. It takes arguements from
> the command line.
> If no arguement is given, it should simply exist. Below is the
> architectureof main() :
#include <cstdlib>
> int main(int argc, char *argv[])
> {
using namespace std;
>
> if( argc == 1 )
> {
> cout << "NO ARGUEMENT"<<endl;
> exit(0);
> }
>
>
> //Other parts of the code
>
> return 0; //LastLine
>
> }
>
>
> It also links with other libraries.
> If no arguement is given on command line, it only outputs "NO
> ARGUEMENT", then hangs there.
> The exit(0) can not exit. Why exit(0) fails to exit from main()?
>
> If I give correct arguements at command line, the program also hangs.
> The return 0 at the LastLine can not exit, either.
>
> The code links some C++ libraries. It only hangs on AIX systems. But
> for Linux, it works fine. Why?
>
> I find that maybe a C++ library causes the problem. What should I do?
> I have to link that library. Otherwise, the linker complains
> "Undefined symbols", although some symbols are not needed in my code,
> but they are used in other libraries.
Supposing you included <cstdlib> as I did above, it sounds like a bug of
your compiler. However you do not need to call exit(). A simple "return
0;" statement would suffice.
|
|
0
|
|
|
|
Reply
|
ivranos1 (46)
|
1/21/2008 12:27:56 AM
|
|
junw2000@gmail.com wrote:
>
> The code links some C++ libraries. It only hangs on AIX systems. But
> for Linux, it works fine. Why?
>
Did you follow any of the advice given when you asked this on c.l.c?
--
Ian Collins.
|
|
0
|
|
|
|
Reply
|
ian-news (9880)
|
1/21/2008 3:23:37 AM
|
|
On Jan 20, 7:23=A0pm, Ian Collins <ian-n...@hotmail.com> wrote:
> junw2...@gmail.com wrote:
>
> > The code links some C++ libraries. It only hangs on AIX systems. But
> > for Linux, it works fine. Why?
>
> Did you follow any of the advice given when you asked this on c.l.c?
>
> --
> Ian Collins.
I find that one of the library that I link causes the problem. It
defines a static object. My code does not use that static object. When
exit the main(), the destructor is called and hangs.
But why it works on some systems?
Thanks.
|
|
0
|
|
|
|
Reply
|
junw2000 (221)
|
1/21/2008 5:59:56 AM
|
|
junw2000@gmail.com wrote:
> On Jan 20, 7:23 pm, Ian Collins <ian-n...@hotmail.com> wrote:
>> junw2...@gmail.com wrote:
>>
>>> The code links some C++ libraries. It only hangs on AIX systems. But
>>> for Linux, it works fine. Why?
>> Did you follow any of the advice given when you asked this on c.l.c?
>>
*Please don't quote signatures*
>
> I find that one of the library that I link causes the problem. It
> defines a static object. My code does not use that static object. When
> exit the main(), the destructor is called and hangs.
> But why it works on some systems?
>
Hangs doing what?
It sounds like you have a platform issue rather than a language one.
The point where the hang occurs should provide your answer.
--
Ian Collins.
|
|
0
|
|
|
|
Reply
|
ian-news (9880)
|
1/21/2008 6:39:00 AM
|
|
<junw2000@gmail.com> wrote in message
news:37b5b395-d673-4ade-8733-9627a3a7e758@i12g2000prf.googlegroups.com...
> I find that maybe a C++ library causes the problem. What should I do?
When it "hangs", just attach it to a debugger and break. I think that you
can see where and why it "hangs"...
--
Pascal
|
|
0
|
|
|
|
Reply
|
nospam48 (2677)
|
1/21/2008 7:08:04 AM
|
|
|
5 Replies
132 Views
(page loaded in 0.091 seconds)
Similiar Articles: 'gcc' failed with exit status 1 - comp.lang.python1 Replies 406 Views (0.054 seconds) Tweet ... svc:/network/physical:default: Method "/lib/svc/method/net-physical" failed with exit status ... Connection refused problem - comp.unix.programmer... perror(0); exit(1); } /* Get date */ if ( (nbytes=read(sd, buf, BUFSIZE-1)) <= 0 ) { fprintf(stderr, "%s: read failed: ", argv[0]); perror(0); exit(1 ... a unix script to send email notification when a sas batch job ...# or exit 0 else printf "Usage:\n AutoNotify program\n" exit ... failed This should print the string "failed" if the command fails. You might want to know the exit ... fork(): how can I kill forked process and all ITS children, but ...... status; /* exit status from child, returned by wait */ long timer=0 ... fork has failed, so do nothing */ fprintf(stderr, "222 fork failed\n"); exit(222 ... how to get the status from scripts running in the background ...I need to: 1. run several scripts concurrently 2. wait until they are done 3. get the exit status 4. If one fails, then I need to do some error handl... Cisco 11500 CSS http keepalive check for web content? - comp.dcom ...... set CONTINUE_ON_ERROR "1" CSS# socket waitfor ${SOCKET} "${WebString}" case-sensitive %% String not found CSS# if ${STATUS} "NEQ" "0" exit script 1 Waitfor: Failed. solaris 10u8 restarter restarted in zone for unknown reason ...... ERROR: svc:/network/ipsec/policy:default: Method "/ usr/sbin/ipsecconf -F" failed with exit ... 0 Replies 383 Views (0.101 seconds) Tweet The difference between return and exit()? - comp.unix.programmer ...Hi, I often see the functions like exit() and close(). Can they replace return in the c program? Which header includes them? What is the difference between exit(0 ... PKGADD Error - comp.unix.solaris0 ... process datastream failed > > > - process </usr/bin/cpio -icdumD -C 512> failed, exit ... use of aio_read and aio_write - comp.unix.programmer... aioRet = aio_read(&cb); > if(aioRet == -1) { > exit(EXIT_FAILURE ... exit(EXIT_FAILURE); > } > /* end of the file . exit */ > if(aio_return(&cb) == 0 ... Exit status - Wikipedia, the free encyclopediaApart from the macros EXIT_SUCCESS and EXIT_FAILURE, the C standard does ... As such, on Unix exit statuses are restricted to values 0-255, the range of an unsigned 8-bit ... Exit Fail - EPIC FAIL Funny Videos and Epic Fail Funny Picturesfail owned pwned pictures - exit fail, fail, exit, design, building, door 7/23/2012 8:09:01 AM
|