Compiling a simple C program using gcc gives the error "could not read symbols" in RHEL6

Solution Verified - Updated -

Issue

  • Compiling a simple C code using gcc throughs the following error:
# cat hw.c
main(){
printf("Hello World");
}
# gcc hw.c
hw.c: In function main:
hw.c:2: warning: incompatible implicit declaration of built-in function printf
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../crt1.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status

Environment

  • Red Hat Enterprise Linux 6.x
  • Arch x86_64

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content