Statically link ncurses to program

前端 未结 3 1593
眼角桃花
眼角桃花 2020-12-06 18:15

I\'m having some problems statically linking ncurses to one of my programs

Here\'s a really simple sample program:

#include


int ma         


        
3条回答
  •  北海茫月
    2020-12-06 18:41

    You need to pass -l options at the end of the command line:

    gcc -static hello_curses.c -o curses -lncurses
    

    When the compiler encounters -lfoo, it links in all the symbols from foo that have been requested by a previous file. If you put -lfoo at the beginning, no symbol has been requested yet, so no symbol gets linked.

提交回复
热议问题