Compiling and linking a 32 bit application on Debian 64 bit

纵饮孤独 提交于 2019-12-04 20:19:33

There are two problems:

  1. Your link command is incorrect: the order of libraries on the link line matters. The command should be: gcc -m32 $^ -o $@ -lcurses
  2. Since you want to link against ncurses, make the last argument -lncurses.

The message shows gcc didn't find the 32bit of ncurse library.

A quick solution: looking on my machine (ubuntu 11.10) , I think should be

gcc -m32 -lncurses $^ -o $@ -v

Where the library is actually at /lib32/libncurses.so.5.9.

Generally, try if you encounter a problem.

gcc -m32 -lcurses $^ -o $@ -v

It'll print out a lot of stuff.

Look for parameters looks like -L, and try to find the library file (libfoo.so or libfoo.a) in the directory .

You probably need the lib32ncurses5-dev package, or something similar, providing the 32 bits variant development package for ncurses.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!