我在项目外部的目录(Ardrone SDK 目录)中开发了一个示例(Ardrone SDK 版本 1.8)并自己制作了 Makefile。但是,出现了这个错误:
teste_ardrone.cpp:68:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
teste_ardrone.cpp:68:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
/tmp/ccKmZ6Wp.o:(.data+0x34): undefined reference to `thread_ardrone_control(void*)'
/tmp/ccKmZ6Wp.o:(.data+0x54): undefined reference to `thread_navdata_update(void*)'
collect2: ld returned 1 exit status
make: *** [all] Error 1
我的制作文件:
SDK_PATH:=$(shell pwd)/../ARDrone_SDK_Version_1_8_20110726/ARDroneLib
PC_TARGET=yes
USE_LINUX=yes
CC =gcc
CFLAGS =-Wall -DGNU_LINUX
LDFLAGS =-static
SRC = teste_ardrone.cpp
INCLUDES = -I$(SDK_PATH)/ \
-I$(SDK_PATH)/Soft/Lib/ \
-I$(SDK_PATH)/Soft/Lib/ardrone_tool/ \
-I$(SDK_PATH)/Soft/Common/ \
-I$(SDK_PATH)/VP_SDK/ \
-I$(SDK_PATH)/VP_SDK/VP_Os/linux/ \
LIB_PATHS = -L/. \
-L$(SDK_PATH)/Soft/Build/targets_versions/ardrone_lib_PROD_MODE_vlib_Linux_3.2.0-41-generic-pae_GNU_Linux_gcc_4.6.3 \
-L$(SDK_PATH)/Soft/Build/targets_versions/vlib_PROD_MODE_Linux_3.2.0-41-generic-pae_GNU_Linux_gcc_4.6.3 \
-L$(SDK_PATH)/Soft/Build/targets_versions/sdk_PROD_MODE_vlib_Linux_3.2.0-41-generic-pae_GNU_Linux_gcc_4.6.3
LIBS = -lpc_ardrone \
-lsdk \
-lpthread \
-lgtk-x11-2.0 \
-lrt \
-lvlib \
BIN = teste_ardrone
all:
$(CC) -o $(BIN) $(SRC) $(INCLUDES) $(LIB_PATHS) $(LIBS) $(LDFLAGS)
我的代码(cpp):
/**
* @file main.cpp
* @author renanprata@ieee.org
* @date 2013/05/14
*/
//ARDroneLib
#include <ardrone_tool/ardrone_time.h>
#include <ardrone_tool/Navdata/ardrone_navdata_client.h>
#include <ardrone_tool/Control/ardrone_control.h>
#include <ardrone_tool/UI/ardrone_input.h>
//Common
#include <config.h>
#include <ardrone_api.h>
//VP_SDK
#include <ATcodec/ATcodec_api.h>
#include <VP_Os/vp_os_print.h>
#include <VP_Os/vp_os_types.h>
#include <VP_Api/vp_api_thread_helper.h>
#include <VP_Os/vp_os_signal.h>
static int32_t exit_ihm_program = 1;
/* Implementing Custom methods for the main function of an ARDrone application */
/* The delegate object calls this method during initialization of an ARDrone application */
C_RESULT ardrone_tool_init_custom(int argc, char **argv)
{
/* Registering for a new device of game controller */
//ardrone_tool_input_add( &gamepad );
/* Start all threads of your application */
START_THREAD( ardrone_control, NULL );
return C_OK;
}
/* The delegate object calls this method when the event loop exit */
C_RESULT ardrone_tool_shutdown_custom()
{
/* Relinquish all threads of your application */
JOIN_THREAD( ardrone_control );
/* Unregistering for the current device */
//ardrone_tool_input_remove( &gamepad );
return C_OK;
}
/* The event loop calls this method for the exit condition */
bool_t ardrone_tool_exit()
{
return exit_ihm_program == 0;
}
C_RESULT signal_exit()
{
exit_ihm_program = 0;
return C_OK;
}
/* Implementing thread table in which you add routines of your application and those provided by the SDK */
BEGIN_THREAD_TABLE
THREAD_TABLE_ENTRY( ardrone_control, 20 )
THREAD_TABLE_ENTRY( navdata_update, 20 )
// THREAD_TABLE_ENTRY( video_stage, 20 )
END_THREAD_TABLE