0

So I finally cleared all the errors and warnings on the C files, and proceeded to link them. I have 2 C files which I need to link with the compiler.

et5ibwqm0.c intfac_fl.c

The compile command I was provided:

gcc -shared -o et5stcklib.so et5ibwqm0.o intfac_fl.o -L$FGLDIR/lib

Doesn't work, I get this error:

et5ibwqm0.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
  • 2
    Try the "file" command to see what it reports on `et51bwqm0.o` and `intfac_fl.o`. Also, it would help to see the commands used to compile them. – ash Nov 20 '15 at 18:32
  • The compiler compiles, the **linker** ... – too honest for this site Nov 20 '15 at 18:43
  • 2
    @Olaf The `gcc` command hides the distinction, since it figures out from the options whether it should compile or link. – Barmar Nov 20 '15 at 18:47
  • @Barmar: I know. It is actually a "driver" for the correct underlying tools (compiler, assembler, linker, etc. Yet it is not the **compiler**. Anyway, we need more information. – too honest for this site Nov 20 '15 at 18:50
  • Have you tried purging all `.o` files in the compilation directory? – user4520 Nov 20 '15 at 18:51
  • @szczurcio Why would that be necessary? He doesn't have `*.o` in the command, so it's not going to look at the other files. – Barmar Nov 20 '15 at 18:52
  • Turns out it was just a missing -m32 specifier which caused the compiler to reject one of the objects – user5586678 Nov 20 '15 at 18:54
  • @Barmar I meant deleting all object files to force recompilation - if `et5ibwqm0.o` is reported as corrupt by `ld`, the first thing I'd do is remove it and have the compiler regenerate it to see if the error persists. As for purging all `.o` files, well, if that one is corrupt, chances are some others will be too. – user4520 Nov 20 '15 at 18:54
  • The problem is probably that he's not compiling the `.o` file with the right options. Deleting it and recompiling it won't fix that, unless he changes the options. – Barmar Nov 20 '15 at 18:57

2 Answers2

0

You tagged this with Informix. Are these C modules that you are trying to call from a 4GL program and therefore need to combine them into a common executable?

If so, just include all of your source modules in the compile directive. Assuming c4gl, something like:

c4gl main.4gl others.4gl et5ibwqm0.c intfac_fl.c -o mainwithccalls.4ge

Dr. Scump
  • 1
  • 1
0

Turns out it was just a missing -m32 specifier which caused the compiler to reject one of the objects – user5586678

Armali
  • 18,255
  • 14
  • 57
  • 171