首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >与GHC连接

与GHC连接
EN

Stack Overflow用户
提问于 2015-05-27 20:35:57
回答 1查看 287关注 0票数 0

我在跟踪这个短教程

并尝试使用GHC (格拉斯哥Haskell编译器,Version 7.10.1)编译Webots应用程序(用C编写),命令如下:

代码语言:javascript
复制
ghc --make -no-hs-main -optc-O 
-I"/Applications/Webots/include/controller/c/" 
-L"/Applications/Webots/lib/" 
-outputdir build/release/ 
advanced_genetic_algorithm_supervisor.c 
Safe 
-o advanced_genetic_algorithm_supervisor

并在链接阶段获得以下错误:

代码语言:javascript
复制
Linking advanced_genetic_algorithm_supervisor ...
Undefined symbols for architecture x86_64:
  "_wb_display_draw_text", referenced from:
      _main in advanced_genetic_algorithm_supervisor.o
  "_wb_display_get_height", referenced from:
      _main in advanced_genetic_algorithm_supervisor.o
  "_wb_display_get_width", referenced from:
      _main in advanced_genetic_algorithm_supervisor.o
  "_wb_emitter_send", referenced from:
      _evaluate_genotype in advanced_genetic_algorithm_supervisor.o
  "_wb_receiver_enable", referenced from:
      _main in advanced_genetic_algorithm_supervisor.o
  "_wb_receiver_get_data", referenced from:
      _check_for_slaves_data in advanced_genetic_algorithm_supervisor.o
  "_wb_receiver_get_queue_length", referenced from:
      _check_for_slaves_data in advanced_genetic_algorithm_supervisor.o
  "_wb_receiver_next_packet", referenced from:
      _check_for_slaves_data in advanced_genetic_algorithm_supervisor.o
  "_wb_robot_cleanup", referenced from:
      _run_optimization in advanced_genetic_algorithm_supervisor.o
  "_wb_robot_get_basic_time_step", referenced from:
      _main in advanced_genetic_algorithm_supervisor.o
  "_wb_robot_get_device", referenced from:
      _main in advanced_genetic_algorithm_supervisor.o
  "_wb_robot_init", referenced from:
      _main in advanced_genetic_algorithm_supervisor.o
  "_wb_robot_step", referenced from:
      _run_seconds in advanced_genetic_algorithm_supervisor.o
      _evaluate_genotype in advanced_genetic_algorithm_supervisor.o
  "_wb_supervisor_field_get_sf_rotation", referenced from:
      _main in advanced_genetic_algorithm_supervisor.o
  "_wb_supervisor_field_get_sf_vec3f", referenced from:
      _main in advanced_genetic_algorithm_supervisor.o
  "_wb_supervisor_field_set_sf_rotation", referenced from:
      _evaluate_genotype in advanced_genetic_algorithm_supervisor.o
  "_wb_supervisor_field_set_sf_vec3f", referenced from:
      _evaluate_genotype in advanced_genetic_algorithm_supervisor.o
  "_wb_supervisor_node_get_field", referenced from:
      _main in advanced_genetic_algorithm_supervisor.o
  "_wb_supervisor_node_get_from_def", referenced from:
      _main in advanced_genetic_algorithm_supervisor.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我认为这意味着编译器无法找到函数(“符号”),尽管它能够通过编译过程解析所有使用-I路径在程序中指定的内容。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-05-27 21:46:23

这意味着链接器找不到那些函数/符号,因为您没有告诉它链接到Webots库。

您需要添加-lsomething,假设库文件名为/Applications/Webots/lib/libsomething.dylib (或libsomething.a)。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30492653

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档