SOEM(C库)的实现

问题描述 投票:0回答:1

我刚刚开始寻找一个名为 SOEM

的库

我已经有一段时间没有使用 .C 和 makefile 了,所以我认为我的错误非常基本。

我已成功安装该库并运行存储库中包含的一些测试脚本。但如果我尝试遵循本教程: https://openethercatsociety.github.io/doc/soem/tutorial_8txt.html 并尝试基本命令,即。

以下示例展示了如何添加将由启动代码调用的 main 函数。在此示例中,main 的唯一目的是生成一个执行 SOEM 的新任务。

int main (void)
{
   rprintp("SOEM (Simple Open EtherCAT Master)\nSimple test\n");
   task_spawn ("simpletest", simpletest, 9, 8192, NULL);

我收到这样的错误:

error: implicit declaration of function ‘rprintp’; did you mean ‘dprintf’? [-Werror=implicit-function-declaration]
  256 |    rprintp("SOEM (Simple Open EtherCAT Master)\nSimple test\n");
      |    ^~~~~~~
      |    dprintf
/home/sigurdrb/SOEM/test/discovery/discovery.c:257:4: error: implicit declaration of function ‘task_spawn’ [-Werror=implicit-function-declaration]
  257 |    task_spawn ("simpletest", simpletest, 9, 8192, NULL);
      |    ^~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [test/discovery/CMakeFiles/discovery.dir/build.make:76: test/discovery/CMakeFiles/discovery.dir/discovery.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:302: test/discovery/CMakeFiles/discovery.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

好像是我没设置好,找不到功能。我使用 cmake 构建了测试脚本。

我一直在尝试遵循的教程是这样的: https://openethercatsociety.github.io/doc/soem/tutorial_8txt.html

我知道这是一个非常具体的问题,所以我对此感到抱歉。我找不到该库的任何论坛。

我希望这个错误是如此普遍,以至于你可以帮助我找到正确的方向。

我已尝试按照相关库的教程进行操作。我找不到比我发布的链接更详细的描述。我尝试使用上面发布的代码生成一个独立的 .c 文件,或者仅使用我编译并以原始形式运行的 test_file 中的函数(rprintp、task_spawn)simple_test.c

c cmake ethercat
1个回答
0
投票

似乎您错过了头文件的包含 本教程是否要求您添加一些内容来编译您在 main 函数中显示的代码?

© www.soinside.com 2019 - 2024. All rights reserved.