側域センサust-10lxを研究で使おうと考えていますが、北陽のサンプルプログラムを実行しようとしたところ、
エラーが発生し実行できない状況です。
実際に動かしている方の意見や、解決策として考えられることを教えていただきたいです。
開発環境
MACOS Sierra 10.12.6
gcc
プログラム
/*!
\example get_distance.c Obtains distance data
\author Satofumi KAMIMURA
$Id$
*/
#include "urg_sensor.h"
#include "urg_utils.h"
#include "open_urg_sensor.h"
#include <stdlib.h>
#include <stdio.h>
static void print_data(urg_t *urg, long data[], int data_n, long time_stamp)
{
#if 1
int front_index;
(void)data_n;
// Shows only the front step
front_index = urg_step2index(urg, 0);
printf("%ld [mm], (%ld [msec])\n", data[front_index], time_stamp);
#else
(void)time_stamp;
int i;
long min_distance;
long max_distance;
// Prints the X-Y coordinates for all the measurement points
urg_distance_min_max(urg, &min_distance, &max_distance);
for (i = 0; i < data_n; ++i) {
long l = data;
double radian;
long x;
long y;
if ((l <= min_distance) || (l >= max_distance)) {
continue;
}
radian = urg_index2rad(urg, i);
x = (long)(l * cos(radian));
y = (long)(l * sin(radian));
printf("(%ld, %ld), ", x, y);
}
printf("\n");
#endif
}
pragma comment(lib, "Ws2_32.lib")
int main(int argc, char *argv[])
{
enum {
CAPTURE_TIMES = 10,
};
urg_t urg;
long *data = NULL;
long time_stamp;
int n;
int i;
if (open_urg_sensor(&urg, argc, argv) < 0) {
return 1;
}
data = (long *)malloc(urg_max_data_size(&urg) * sizeof(data[0]));
if (!data) {
perror("urg_max_index()");
return 1;
}
// Gets measurement data
#if 0
// Case where the measurement range (start/end steps) is defined
urg_set_scanning_parameter(&urg,
urg_deg2step(&urg, -90),
urg_deg2step(&urg, +90), 0);
#endif
urg_start_measurement(&urg, URG_DISTANCE, URG_SCAN_INFINITY, 0);
for (i = 0; i < CAPTURE_TIMES; ++i) {
n = urg_get_distance(&urg, data, &time_stamp);
if (n <= 0) {
printf("urg_get_distance: %s\n", urg_error(&urg));
free(data);
urg_close(&urg);
return 1;
}
print_data(&urg, data, n, time_stamp);
}
// Disconnects
free(data);
urg_close(&urg);
#if defined(URG_MSC)
getchar();
#endif
return 0;
}
結果
get_distance.c:8:10: fatal error: 'urg_sensor.h' file not found
#include "urg_sensor.h"
^~~~~~~~~~~~~~
1 error generated.
saitolab-no-iMac2015:c inohideaki$ gcc get_distance.c
Undefined symbols for architecture x86_64:
"_open_urg_sensor", referenced from:
_main in get_distance-52a2ed.o
"_urg_close", referenced from:
_main in get_distance-52a2ed.o
"_urg_error", referenced from:
_main in get_distance-52a2ed.o
"_urg_get_distance", referenced from:
_main in get_distance-52a2ed.o
"_urg_max_data_size", referenced from:
_main in get_distance-52a2ed.o
"_urg_start_measurement", referenced from:
_main in get_distance-52a2ed.o
"_urg_step2index", referenced from:
_print_data in get_distance-52a2ed.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
saitolab-no-iMac2015:c inohideaki$ gcc urg_sensor.h
saitolab-no-iMac2015:c inohideaki$ gcc get_distance.c
Undefined symbols for architecture x86_64:
"_open_urg_sensor", referenced from:
_main in get_distance-5c913b.o
"_urg_close", referenced from:
_main in get_distance-5c913b.o
"_urg_error", referenced from:
_main in get_distance-5c913b.o
"_urg_get_distance", referenced from:
_main in get_distance-5c913b.o
"_urg_max_data_size", referenced from:
_main in get_distance-5c913b.o
"_urg_start_measurement", referenced from:
_main in get_distance-5c913b.o
"_urg_step2index", referenced from:
_print_data in get_distance-5c913b.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
saitolab-no-iMac2015:c inohideaki$ ls
Makefile get_distance_intensity.c open_urg_sensor.o urg_detect_os.h
angle_convert_test.c get_multiecho reboot_test.c urg_errno.h
calculate_xy get_multiecho.c sensor_parameter urg_ring_buffer.h
calculate_xy.c get_multiecho_intensity sensor_parameter.c urg_sensor.h
find_port get_multiecho_intensity.c sync_time_stamp urg_sensor.h.gch
find_port.c ld_setupapi.sh sync_time_stamp.c urg_serial.h
get_distance ld_wsock.sh timeout_test.c urg_serial_utils.h
get_distance.c open_urg_sensor.c urg_connection.h urg_tcpclient.h
get_distance_intensity open_urg_sensor.h urg_debug.h urg_utils.h
saitolab-no-iMac2015:c inohideaki$ gcc get_distance.c
get_distance.c:52:1: error: unknown type name 'pragma'
pragma comment(lib, "Ws2_32.lib")
^
get_distance.c:52:21: error: expected identifier
pragma comment(lib, "Ws2_32.lib")
^
get_distance.c:52:34: error: expected ';' after top level declarator
pragma comment(lib, "Ws2_32.lib")
^
;
3 errors generated.
saitolab-no-iMac2015:c inohideaki$ gcc get_distance.c
get_distance.c:52:1: error: unknown type name 'pragma'
pragma comment(lib, "Ws2_32.lib")
^
get_distance.c:52:21: error: expected identifier
pragma comment(lib, "Ws2_32.lib")
^
get_distance.c:52:34: error: expected ';' after top level declarator
pragma comment(lib, "Ws2_32.lib")
^
;
3 errors generated.
saitolab-no-iMac2015:c inohideaki$ gcc get_distance.c
Undefined symbols for architecture x86_64:
"_open_urg_sensor", referenced from:
_main in get_distance-e29669.o
"_urg_close", referenced from:
_main in get_distance-e29669.o
"_urg_error", referenced from:
_main in get_distance-e29669.o
"_urg_get_distance", referenced from:
_main in get_distance-e29669.o
"_urg_max_data_size", referenced from:
_main in get_distance-e29669.o
"_urg_start_measurement", referenced from:
_main in get_distance-e29669.o
"_urg_step2index", referenced from:
_print_data in get_distance-e29669.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
urg_sensor.h というファイルは同じディレクトリに入っております。
どのように改善すればよろしいでしょうか。
よろしくお願いします。
MACでの即行きセンサのプログラム
ページ移動
- 掲示板
- ↳ C言語何でも質問掲示板
- ↳ 四聖龍神録2 掲示板
- ↳ 四聖龍神録Plus掲示板
- ↳ AerobeatPlus掲示板
- 副次コンテンツ
- ↳ 作品お披露目掲示板
- 登録ユーザー用コンテンツ
- ↳ 登録ユーザー掲示板
- コミュニティフォーラム
- ↳ みんなでソースコードをレビューしよう
- ↳ 3DCGソフト使用者のコミュ
- ↳ Win32 API
- ↳ 組み込み系スクリプト言語をつかってみよう
- ↳ 東方好きあつまれ
- ↳ C言語誰でも交流サイト - mixC++ -
- ↳ ビット論理演算が好きな人♪
- ↳ 企画関係について語ろうか
- ↳ エフェクトアニメーション
- ↳ 学生で集まってみる?
- ↳ DirectX SDK
- ↳ マイコン/FPGA電子工作部
- ↳ PHPに可能性を無限大
- ↳ Code Golf を楽しもう!
- ↳ 作曲している人で話し合ってみませんか♪
- ↳ ソフト制作コミュ
- ↳ El Shaddai - エルシャダイ -
- ↳ PSPプログラミング
- ↳ CINEMA 4D
- ↳ お絵かきコミュニティ
- ↳ 素材作ってみたよ!
- ↳ OpenGL
- ↳ OpenCV
- ↳ RPGを作りたい!
- ↳ ポケモン好き集まれ
- ↳ ならば .NETをやらないか?
- ↳ 1から勉強してみないか?
- ↳ 赤髪超大好き♪
- ↳ ノースリーブ
- ↳ 伝説の戦士プリキュアを語ろう
- ↳ コンテストコミュニティー
- ↳ DXライブラリ何でも質問コミュニティ
- ↳ 四聖龍神録コミュニティ
- ↳ HTML/CSS/JavaScript
- ↳ 生放送コミュ
- ↳ サンプルを共有するコミュニティ
- ↳ おすすめマーカー
- ↳ minecraft
- ↳ Xtal Language
- ↳ マインクラフト
- ↳ 数学やらないか?
- ↳ 習ったことをプログラムで表してみよう!
- ↳ 小物アプリ作成や ら な い か
- ↳ AIの可能性は無限大
- ↳ 自作OS製作(GUI入門)[雑談]
- ↳ リレーコーディング
- ↳ Unix/Linux
- ↳ 競技プログラミングごっこやろうぜ
- ↳ 夏休みプログラミングイベント2012 in MixC++
- ↳ D言語を広めよう
- ↳ Scala布教の会
- ↳ 3Dゲーム作ろうぜ!モデリング~プログラミングまで
- ↳ 言語に興味を持ったら是非!!
- ↳ レイヴンズ・ネスト
- ↳ C言語とC++言語のコミュニティー!
- ↳ 放課後ふぁんたじあ
- ↳ マイ サンプルズ
- ↳ ガンヲタの館
- ↳ 歯科機器
- ↳ 歯科機器情報
- ↳ 52歳からはじめるC言語
- mixC++更新・仕様変更履歴