Error

A

arunix

hello all,
i have a problem. i dont know much about "C"
i write a simple program[given below].

#include<stdio.h>
int main()
{
printf("Hello World!!!!");
}

but after compile it shows this

gcc ex-c-1.cpp

"error"
/tmp/cc6ae3vQ.o:(.eh_frame+0x12): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status

i dont know what is that. i google this error but nothing.
so what i should Do.

is it the right way to write or compile the program?

Thanks
 
K

Keith Thompson

arunix said:
i have a problem. i dont know much about "C"
i write a simple program[given below].

#include<stdio.h>
int main()
{
printf("Hello World!!!!");
}

but after compile it shows this

gcc ex-c-1.cpp

"error"
/tmp/cc6ae3vQ.o:(.eh_frame+0x12): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status
[...]

This is really more a question about your compiler than about the C
language.

Since you named your source file with a ".cpp" suffix, gcc assumes
it's C++, not C. If you want to compile C++ code, use the "g++"
command rather than the "gcc" command. If you want to compile C code,
rename the file from "ex-c-1.cpp" to "ex-c-1.c".
 
A

arunix

arunix said:
i have a problem. i dont know much about "C"
i write a simple program[given below].
#include<stdio.h>
int  main()
{
     printf("Hello World!!!!");
}
but after compile it shows this
gcc ex-c-1.cpp
"error"
/tmp/cc6ae3vQ.o:(.eh_frame+0x12): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status

[...]

This is really more a question about your compiler than about the C
language.

Since you named your source file with a ".cpp" suffix, gcc assumes
it's C++, not C.  If you want to compile C++ code, use the "g++"
command rather than the "gcc" command.  If you want to compile C code,
rename the file from "ex-c-1.cpp" to "ex-c-1.c".

--
Keith Thompson (The_Other_Keith) (e-mail address removed)  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Thanks Ken i was wrong at that.
 
S

spinoza1111

[A good question]

Arunix, this reply isn't addressed to you but rather to Thompson.
arunix said:
i have a problem. i dont know much about "C"
i write a simple program[given below].
#include<stdio.h>
int  main()
{
     printf("Hello World!!!!");
}
but after compile it shows this
gcc ex-c-1.cpp
"error"
/tmp/cc6ae3vQ.o:(.eh_frame+0x12): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status

This is really more a question about your compiler than about the C
language.
Since you named your source file with a ".cpp" suffix, gcc assumes
it's C++, not C.  If you want to compile C++ code, use the "g++"
command rather than the "gcc" command.  If you want to compile C code,
rename the file from "ex-c-1.cpp" to "ex-c-1.c".
--
Keith Thompson (The_Other_Keith) (e-mail address removed)  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Thanks Ken i was wrong at that.

Interestingly, Kiki failed to point out that:

(1) A \n (newline) may be required in some environments and can't hurt
to ensure that the message is seen

(2) The program should return 0 and declare a void formal parameter:

#include <stdio.h>

int main(void)
{
printf("hello, world\n");
return 0;
}

This shows how the "standards" are in fact used here.

When it comes to answering questions, the standards are ignored since
in fact in most environments the above changes are not needed.

But when it comes to the politics of personal destruction, as in the
case of Peter Seebach's unprofessional, uninformed, and poorly written
viral attack on Schildt, these nits are foregrounded.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top