2015-05-27 3 views
0

Я после этого short tutorialСвязывание с GHC

и пытается скомпилировать Webots приложение (написано в C) с использованием GHC (Glasgow Haskell Compiler, версия 7.10.1) с помощью следующей команды:

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 

и получить следующее сообщение об ошибке во время стадии компоновки:

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

ответ

1

Это означает, что компоновщик не может найти эти функции/символы, t сообщить ему ссылку на библиотеку Webots.

Вам необходимо добавить -lsomething, считая, что имя файла библиотеки /Applications/Webots/lib/libsomething.dylib (или libsomething.a).

+0

не знал о -l флаг. спасибо –

+0

Действительно '-lController' должен ссылаться на' libController.dylib', содержащийся в пути '/ Applications/Webots/lib /'. – FabienRohrer

Смежные вопросы