首页 \ 问答 \ FLEX无法构建lex.yy.c(FLEX Cannot build lex.yy.c)

FLEX无法构建lex.yy.c(FLEX Cannot build lex.yy.c)

  • 下载flex-2.5.37.tar.gz
  • 解压缩并按照INSTALL的说明进行操作: ./configure + make + make install
  • 在一个新文件夹中,我编写了一个文件example.l其中包含:

    %{
    int a = 0, b = 0;
    %}
    
    %%
    \n   ++a; ++b;
    .    ++b;
    
    %%
    int main()
    {
         yylex();
         printf("%d - %d", a, b);
    }
    

    这是他们网站的一个基本例子。 计算文件中的行和字符。

  • 在终端中,我运行flex example.l 。 它生成了lex.yy.c
  • 之后:
    - gcc lex.yy.c -o lexyy为体系结构x86_64抛出未定义的符号
    - gcc lex.yy.c -lflld:找不到-lfl的库
    - gcc lex.yy.c -ll :生成a.out ,但是当我针对文件运行它时,它不起作用(打印“0 - 0”)。

    似乎我无法编译这个该死的文件。 它如何知道在哪里找到必要的库? 不应该从这里链接工作(这个当前文件夹)?

    我无法得到最简单的例子,这有点令人沮丧。


  • Downloaded flex-2.5.37.tar.gz
  • Unpacked and followed INSTALL's instructions: ./configure + make + make install
  • In a new folder, I've written a file example.l containing:

    %{
    int a = 0, b = 0;
    %}
    
    %%
    \n   ++a; ++b;
    .    ++b;
    
    %%
    int main()
    {
         yylex();
         printf("%d - %d", a, b);
    }
    

    which is a basic example from their website. Counting lines and characters in a file.

  • In a terminal, I ran flex example.l. It generated lex.yy.c
  • After that:
    - gcc lex.yy.c -o lexyy: Throws undefined symbols for architecture x86_64
    - gcc lex.yy.c -lfl: ld: library not found for -lfl
    - gcc lex.yy.c -ll: Generates a.out, but when I run it against a file, it doesn't work (prints "0 - 0").

    It seems that I can't get this damn file to compile. How does it know where to find the necessary libraries? Shouldn't the linking work from here (this current folder)?

    It's a bit depressing that I can't get the simplest of examples going.


  • 原文:https://stackoverflow.com/questions/21223862
    更新时间:2023-11-06 12:11

    最满意答案

    尝试使用:map命令。 它显示所有当前映射,包括使用<leader>创建的映射。


    Try with :map command. It shows all current mappings including those created with <leader>.

    相关问答

    更多
    • 尝试使用:map命令。 它显示所有当前映射,包括使用创建的映射。 Try with :map command. It shows all current mappings including those created with .
    • 要查看当前为定义的当前值,请使用: :let mapleader 生产产量如下: mapleader, 如果以前没有设置,它可能是未定义的,默认为反斜杠\ To see the current value currently defined for , use: :let mapleader Producing output like: mapleader , It may be undefined if not previously set, defaulting in ...
    • 当您使用map声明映射时,映射的行为就像您真正以交互方式按下键一样。 触发其他映射。 这里你的问题不是nnoremap : ; 也与nnoremap ; : nnoremap ; : 。 它位于:map :anything_else 。 您应该使用以下命令声明最后一个映射:noremap而不是:map 。 When you declare a mapping with map, the mapping behaves as if you were really interactivel ...
    • 要查看所有映射,请键入:map 。 要查看映射(s)适用于给定的前缀,请输入:map h 。 可能发生的情况是,你有一些其他的h映射需要多个字符。 例如,如果你也有map hx ,那么vim会暂停timeoutlen毫秒(请参阅:help tm和ttm ),然后再尝试遵守更短的h ,以防你实际尝试输入更长的一。 所以你需要跟踪你的更长的映射来自哪里,并可能删除它们。 To see all your mappings, type :map. To see wha ...
    • 我找到答案(最终)并解决了另一个问题。 解决方案在于这个unixstack问题的答案 。 首先,您需要告诉vim终端使用的转义密钥代码。 我这样做了 : function Allmap(mapping) execute 'map' a:mapping execute 'map!' a:mapping endfunction call Allmap(' [1;2 ') call Allmap(' [1;2A ') call Allm ...
    • Vanilla vim不支持同时输入的映射。 但是,我在vim网站上找到了这个脚本。 http://www.vim.org/scripts/script.php?script_id=2425 它被称为琶音。 用法完全符合您的预期,因此对于您的情况: :Arpeggio noremap [ gT 看起来有一些警告w / r / t具有相同键的多个映射; 虽然不太熟悉剧本。 阅读他们的文档将是一个很好的起点。 希望有所帮助! Vanilla vim doesn't support mappin ...
    • 您可以使用元编程:execute来自动创建这些映射: for i in range(1, 99) execute printf('nnoremap %d :%db', i, i) endfor 也可以定义一个映射(只有一个前缀),然后通过getchar()查询该数字。 这里面临的挑战是确定何时结束这一点,您可以通过单独的映射免费获得某些内容(由于'timeout' )。 这就是为什么我更喜欢这里的第一个解决方案。 You can use meta-programming w ...
    • 这可能会压制警告: :nnoremap p some fancy command here 但我怀疑这个警告实际上并不是来自你的映射。 我怀疑冲突的映射是用定义的,并且在映射后进行映射。 如果已存在冲突的地图, 将发出E227 。 见:h E227 。 挖掘第二个映射源(可能是插件)并查看是否是这种情况。 大多数编写良好的插件为您提供了一种使用自己的映射或覆盖它们的方法,通过设置全局标志来完全禁用映射,或者将检测到您已将其他映射映射到特定函 ...
    • 是的, :execute命令: :exe[cute] {expr1} .. Executes the string that results from the evaluation of {expr1} as an Ex command. 所以你的榜样就是 for i in [1, 2, 3] execute 'nnoremap '.i.' '.i.'gt' endfor Yup, the :execute command: :ex ...
    • 使用:noremap ,不考虑原始映射。 虽然:noremap通常是首选,以避免与其他映射的交互,这里你需要允许重新映射: nmap ig 此插件提供映射以便于重新映射; 然后,原来的ig甚至没有定义,也可以免费用于其他用途! 因此,除非你想要两者兼顾 ,否则更喜欢这样: nmap IndentGuidesToggle 注意:这些都是由插件记录的:help indent-guides-mappings 。 With :nor ...

    相关文章

    更多

    最新问答

    更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。