g++ -m32

Hello,

I am trying to create a 32 bit executable on my 64 bit linux machine.

I have the following makefile:

1
2
3
4
5
6
7
8
9
10
11
OBJS = Subtract.o
CC = g++
DEBUG = -g
CFLAGS = -fPIC -Wall -m32 -c $(DEBUG)
LFLAGS = -Wall -m32 $(DEBUG) -L/usr/lib64/gcc/x86_64-suse-linux/4.3 -lstdc++

test:	$(OBJS) 
	$(CC) $(LFLAGS) $(OBJS) -o test

Subtract.o : Subtract.cpp
	$(CC) $(CFLAGS) Subtract.cpp


I am able to create the .o file but not able to create the executable file 'test'.

I am getting the following link error, even though I have specified the path to the library:

g++ -Wall -m32 -g -L/usr/lib64/gcc/x86_64-suse-linux/4.3 -lstdc++ Subtract.o -o test
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-suse-linux/4.3/libstdc++.so when searching for -lstdc++
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-suse-linux/4.3/libstdc++.a when searching for -lstdc++
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-suse-linux/4.3/libstdc++.so when searching for -lstdc++
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-suse-linux/4.3/libstdc++.a when searching for -lstdc++
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lstdc++
collect2: ld returned 1 e


Please help.

H
You're trying to link the 64-bit versions of the libraries.
I am not sure which library I would need to install to avoid linking to 64 bit lib.
Thank you.

After searching a bit, I required to install libstdc++43-devel-32bit and gcc43-32bit

H.
Topic archived. No new replies allowed.