Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-07-2009, 05:20 AM   #1
LQ Newbie
Registered: Jul 2009
Posts: 4

Rep: Reputation: 0
Compiling 32 bit sample program on 64 bit fedora using -m32 option

I have Fedoara 11 install on my PC. I want to compile program as 32 by g++ option -m32. I have 32 bit library install on my machine which present in path

and 64 bit library is on path

When i compile my sample program with -c & -m32 option it compile correctly
c++ -c -m32 Sample.cpp
but when i am trying to create executable by command
c++ Sample.o -m32 -o Sample
then it gives linking error as

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.0/ when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.0/libstdc++.a when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.0/ when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.0/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status

Can anybody please tell me solution for this problem
Old 10-07-2009, 05:28 AM   #2
ReliaFree Maintainer
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,812
Blog Entries: 1

Rep: Reputation: 259Reputation: 259Reputation: 259
You have to explicitly tell the linker to use the libstdc++ in /usr/lib/gcc/x86_64-linux-gnu/4.4.0/32.
Old 10-07-2009, 07:42 AM   #3
LQ Newbie
Registered: Jul 2009
Posts: 4

Original Poster
Rep: Reputation: 0
How can i explicitly tell linker. I have set that path in LD_LIBRARY_PATH as well as i have given it in -L option while compiling it still it gives same error.

Last edited by pankajdev; 10-07-2009 at 09:29 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] File size limitations of a 32 bit program running under a 64 bit kernel acerostech Linux - Server 1 04-19-2009 10:01 AM
compiling 64 bit kernel in 32 bit environment tytus Linux - Kernel 8 12-11-2008 10:24 AM
compiling 32 bit application on 64 bit linux(x86_64) uttam_h Linux - Software 16 07-19-2008 02:33 PM
32/64 bit libs - FC6/gcc 4.1.1 -m32 picking up 64 bit library marier Fedora 0 04-24-2007 12:57 PM
Assembling a 32 bit sample program in a 64 bit world debiant Programming 0 10-14-2006 02:52 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:34 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration