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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.