- 积分
- 19
贡献97
飞刀26 FD
注册时间2017-1-5
在线时间5 小时
扫一扫,手机访问本帖
|
在Ubuntu pc上编译 OKMX6S-S2-Linux用户资料_20170210\OKMX6X-S2用户资料(A)\Linux\测试程序及源码\test\gui\can中的工程,没通过啊,提示信息:
/usr/local/arm/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-linux-g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/QtEmbedded-4.8.5-arm/mkspecs/qws/linux-arm-g++ -I. -I/usr/local/Trolltech/QtEmbedded-4.8.5-arm/include/QtCore -I/usr/local/Trolltech/QtEmbedded-4.8.5-arm/include/QtNetwork -I/usr/local/Trolltech/QtEmbedded-4.8.5-arm/include/QtGui -I/usr/local/Trolltech/QtEmbedded-4.8.5-arm/include -I. -I. -I. -o main.o main.cpp
/usr/local/arm/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-linux-g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/QtEmbedded-4.8.5-arm/mkspecs/qws/linux-arm-g++ -I. -I/usr/local/Trolltech/QtEmbedded-4.8.5-arm/include/QtCore -I/usr/local/Trolltech/QtEmbedded-4.8.5-arm/include/QtNetwork -I/usr/local/Trolltech/QtEmbedded-4.8.5-arm/include/QtGui -I/usr/local/Trolltech/QtEmbedded-4.8.5-arm/include -I. -I. -I. -o mainwindow.o mainwindow.cpp
mainwindow.cpp: In member function 'void MainWindow::on_send_clicked()':
mainwindow.cpp:32:5: error: 'string' is not a member of 'std'
mainwindow.cpp:32:18: error: expected ';' before 'str'
mainwindow.cpp:34:8: error: 'str' was not declared in this scope
mainwindow.cpp:43:30: error: 'str' was not declared in this scope
mainwindow.cpp: In member function 'void MainWindow::stopcan(int)':
mainwindow.cpp:114:5: error: '::close' has not been declared
make: *** [mainwindow.o] 错误 1
mainwindow.cpp文件中相关代码:
void MainWindow::on_send_clicked()
{
struct can_frame frame;
memset(&frame,0,sizeof(struct can_frame));
std::string str=ui->edit->text().toStdString(); //32行
if(str.length() > 8)
{
QMessageBox::about(this,"error","length of send string must less than 8 bytes");
return;
}
frame.can_id = 0x123;
strcpy((char*)frame.data,str.c_str());
frame.can_dlc = str.length();
sendto(socket,&frame,sizeof(struct can_frame),0,(struct sockaddr*)&addr,sizeof(addr));
return;
}
void MainWindow::stopcan(int v)
{
if(t)
{
t->stop();
t->deleteLater();
}
::close(socket); //114行
if(v == 0)
system("ifconfig can0 down");
else
system("ifconfig can1 down");
}
语法错误,能不能烦请技术人员检查验证一下。 |
|