首页 > 解决方案 > C:使用 clang 在 Visual Studio Code 中设置自定义入口点

问题描述

我正在尝试将 clang 设置为使用名为 entry() 的函数(而不是 main)作为入口点(以防止 C 运行时初始化),但编译器似乎无法识别任何入口设置参数 - - 它一直说应该工作的参数未使用)。执行 -eentry 会显示此消息:

clang: warning: argument unused during compilation: '-e entry' [-Wunused-command-line-argument]

然后:

clang: error: linker command failed with exit code 1561 (use -v to see invocation)

执行 -Wl,-emymain 会显示此消息:

At line:1 char:120
+ ...  -nostartfiles -nostdinc -nostdlib -nodefaultlibs --debug -Wl,-eentry
+                                                                  ~
Missing argument in parameter list.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingArgument

然后:

clang: error: linker command failed with exit code 1561 (use -v to see invocation)

执行 -Xlinker -eentry 会显示此消息:

clang: warning: argument unused during compilation: '-Xlinker -eentry' [-Wunused-command-line-argument]

然后:

clang: error: linker command failed with exit code 1561 (use -v to see invocation)

标签: cvisual-studio-codeclanglinker-errors

解决方案


推荐阅读