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 -lfl
: ld:找不到-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 generatedlex.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
最满意答案
尝试使用
:map
命令。 它显示所有当前映射,包括使用<leader>
创建的映射。Try with
:map
command. It shows all current mappings including those created with<leader>
.
相关问答
更多-
显示所有引导者映射(Show all leader mappings)[2022-03-15]
尝试使用:map命令。 它显示所有当前映射,包括使用创建的映射。 Try with :map command. It shows all current mappings including those created with . -
显示当前的
键设置?(Show current [2022-04-21]key setting?) 要查看当前为定义的当前值,请使用: :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 ... -
Vim:
h映射慢(Vim: [2023-04-27]h mapping slow) 要查看所有映射,请键入:map 。 要查看映射(s)适用于给定的前缀,请输入:maph 。 可能发生的情况是,你有一些其他的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 ... -
如何在Vim中映射
char?(How map [2022-02-23]char in Vim?) 使用:noremap ,不考虑原始映射。 虽然:noremap通常是首选,以避免与其他映射的交互,这里你需要允许重新映射: nmapig 此插件提供 映射以便于重新映射; 然后,原来的 ig甚至没有定义,也可以免费用于其他用途! 因此,除非你想要两者兼顾 ,否则更喜欢这样: nmap IndentGuidesToggle 注意:这些都是由插件记录的:help indent-guides-mappings 。 With :nor ...