zoukankan      html  css  js  c++  java
  • LDFLAGS 与 LDLIBS

    今天下载了开源程序“贪吃蛇” (github地址 : https://github.com/taylorconor/tinytetris.git) 在编译时,出现如下错

    linux:~/code/other/tinytetris$ make
    g++   -lcurses  tinytetris.cpp   -o tinytetris
    /tmp/ccNKijAL.o: In function `F()':
    tinytetris.cpp:(.text+0xf7): undefined reference to `move'
    tinytetris.cpp:(.text+0x161): undefined reference to `stdscr'
    tinytetris.cpp:(.text+0x171): undefined reference to `wattr_on'
    tinytetris.cpp:(.text+0x184): undefined reference to `printw'
    tinytetris.cpp:(.text+0x19c): undefined reference to `stdscr'
    tinytetris.cpp:(.text+0x1ac): undefined reference to `wattr_off'
    tinytetris.cpp:(.text+0x1ce): undefined reference to `move'
    tinytetris.cpp:(.text+0x1e7): undefined reference to `printw'
    tinytetris.cpp:(.text+0x1ec): undefined reference to `refresh'
    /tmp/ccNKijAL.o: In function `L()':
    tinytetris.cpp:(.text+0x634): undefined reference to `stdscr'
    tinytetris.cpp:(.text+0x63c): undefined reference to `wgetch'
    /tmp/ccNKijAL.o: In function `main':
    tinytetris.cpp:(.text+0x83f): undefined reference to `initscr'
    tinytetris.cpp:(.text+0x844): undefined reference to `start_color'
    tinytetris.cpp:(.text+0x877): undefined reference to `init_pair'
    tinytetris.cpp:(.text+0x89c): undefined reference to `resizeterm'
    tinytetris.cpp:(.text+0x8a1): undefined reference to `noecho'
    tinytetris.cpp:(.text+0x8a8): undefined reference to `stdscr'
    tinytetris.cpp:(.text+0x8b5): undefined reference to `wtimeout'
    tinytetris.cpp:(.text+0x8bf): undefined reference to `curs_set'
    tinytetris.cpp:(.text+0x8c6): undefined reference to `stdscr'
    tinytetris.cpp:(.text+0x8d8): undefined reference to `box'
    tinytetris.cpp:(.text+0x8e2): undefined reference to `endwin'
    collect2: error: ld returned 1 exit status
    <builtin>: recipe for target 'tinytetris' failed
    make: *** [tinytetris] Error 1

    找不到很多库文件中的函数。

    查看github上相关issuse,得知是
    LDFLAGS的问题,将Makefile中LDFLAGS 替换为LDLIBS, 问题得到解决。
    
    
    DLIBS is for libraries, LDFLAGS should be used for flags/search paths (-L) 

    LDFLAGS是用来制定动态Library调用的参数集
     
  • 相关阅读:
    事务传播机制,搞懂。
    洛谷 P1553 数字反转(升级版) 题解
    洛谷 P1200 [USACO1.1]你的飞碟在这儿Your Ride Is Here 题解
    洛谷 P1055 ISBN号码 题解
    洛谷 P2141 珠心算测验 题解
    洛谷 P1047 校门外的树 题解
    洛谷 P1980 计数问题 题解
    洛谷 P1008 三连击 题解
    HDU 1013 题解
    HDU 1012 题解
  • 原文地址:https://www.cnblogs.com/rohens-hbg/p/11104231.html
Copyright © 2011-2022 走看看