getting following error with the command g++ -o test -L . -l pq
libpq.so: file not recognized: File format not recognized
#file libpq.so
libpq.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), not stripped
gcc version 4.1.2 20070115 (SUSE Linux)
I am getting the same error if I try to use -l dbodbc
instead of -l pq
.
Note that test.c
is a simple hello world program.
Thanks in Advance.
A "File is Not Recognized Format Error" is produced when attempting to import a drawing file into RAM Concept. The error occurs on some machines when the drawing file is saved on a network drive. The cause of the error is unknown.
The “Excel file in unrecognizable format error” occurs when the Excel file you are trying to load is corrupted. Microsoft has ensured that the workbook will be recoverable when the file is imported into excel but there are times when the automatic recovery does not happen.
First, you’re specifying the -S flag, which causes gcc to emit assembly code, rather than object code. Second, you’re missing the -c flag, which tells gcc to compile the file to an object file, but not link it.
Second, you’re missing the -c flag, which tells gcc to compile the file to an object file, but not link it. If you just remove -S and change nothing else, you’ll end up with an executable program named file1.o and another named file2.o, rather than two object files.
file /usr/bin/g++
tells you that g++
itself is a 64-bit executable, i.e. it runs on a 64-bit machine, it doesn't tell you that g++ can compile 64-bit code (it's very unlikely but it could be a cross compiler for a completely different processor!) Use g++ -v
or g++ -dumpmachine
to find out what target it generates executables for.
G++ doesn't actually use that library, it just passes the -l
option to the linker, so the error is coming from the linker, ld
If ld
and objdump
are both saying they can't recognize the library but the same file is fine on a different machine, I would try updating or reinstalling the binutils
package, which provides both ld
and objdump
.
You might have a 32-bit binutils
installed, so its ld
and objdump
wouldn't understand the x86_64 library. Ensure you have the 64-bit (i.e. x86_64) binutils RPM installed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With