Compiler error:/tmp/ccyogqyq. O :(. eh_frame + 0 × 12): Undefined reference to '_ gxx_personality_v0' col

Source: Internet
Author: User

This afternoon, I wrote a C program file named test. cpp. For the file content, see the appendix. /Tmp/ccyogqyq. O :(. eh_frame + 0x12): Undefined reference to '_ gxx_personality_v0' collect2: LD returned 1 exit status error occurs during GCC compilation. The problem of using C ++ compilation disappears. This error is caused by the filename suffix. I changed test. cpp to test. C, and then compiled it using gcc again. The specific reasons are to be further studied.

Appendix: Test. cpp

# Include <stdio. h>
# Include <stdlib. h>
# Include <sys/types. h>

 

U_int64_t gen64 (char type, char data, int CID, int mid)
{
U_int64_t ret = 0;
Unsigned char TMP = 0;

Switch (type)
{
Case 'p ':
TMP = 0;
Break;
Case 'C ':
TMP = 0x10;
Break;
Case 'N ':
TMP = 0x20;
Break;
Case 'A ':
TMP = 0x30;
Break;
Default:
Fprintf (stderr, "gen64 type has problem./N ");
}
Switch (data)
{
Case 'M ':
TMP | = 0x00;
Break;
Case's ':
TMP | = 0x01;
Break;
Case 'A ':
TMP | = 0x02;
Break;
Case 'p ':
TMP | = 0x03;
Break;
Default:
Fprintf (stderr, "gen64 data has problem./N ");
}
RET | = (u_int64_t) TMP <56) + (u_int64_t) (CID & 0 xFFFF) <32) + (u_int64_t) (Mid & 0 xffffffff );

Return ret;
}

Int main ()
{
Printf ("P, M, 1,1: % lu/N", gen64 ('P', 'M', 1, 1 ));

Return 0;

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.