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调用的参数集
     
  • 相关阅读:
    springboot2.0集成RestTemplate
    RestTemplate HttpMessageConverter报错的解决方案no suitable HttpMessageConverter
    vue条件渲染+列表渲染+事件处理器
    vue计算属性+vue中class与style绑定
    vue选项数据+vue模板语法
    vue安装配置+生命周期
    sass案例--实现高仿今日头条H5版新闻列表页
    sass内置函数
    sass继承+嵌套+条件控制
    sass常见的基本数据类型+加减乘除基本运算
  • 原文地址:https://www.cnblogs.com/rohens-hbg/p/11104231.html
Copyright © 2011-2022 走看看