此代码不起作用
知道为什么
#include <QCoreApplication>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include "a.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
boost::asio::io_service io;
std::cout << "Wait for five seconds\n";
boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
// t.wait();
A *vvv=new A();
std::cout << "Hello, world!\n";
t.async_wait(&print);
std::cout << "Keep cool and wait!\n";
return a.exec();
}
void print(const boost::system::error_code& /*e*/)
{
std::cout << "You are cool!\n";
}
错误:
D:\qtsrc\asiotry\main.cpp:14:错误:C2065:'print':未声明的标识符