我正在运行我的代码,它编译得很好,没有任何错误,并且用于向终端发送输出,但现在它提示我You must select a host application to "run" a commands only target
。
我不知道自己做了什么,而且我以前从未遇到过这个问题。有没有人想过如何选择正确的主机应用程序?
非常感谢任何帮助,万分感谢。
这是我尝试运行的test.cc
文件代码。
#include <iostream>
#include <fstream>
#include <TrajectoryDSGenerator.hh>
#include <DSAdjust.hh>
int
main()
{
// REAL THING!!
// Initial conditions
uu::Vector x0(2);
x0.set(0, 5.0);
x0.set(1, 10.0);
// Real Parameter
uu::Vector P(4);
P.set(0, 2);
P.set(1, 20);
P.set(2, x0[0]);
P.set(3, x0[1]);
uu::TrajectoryDSGenerator ds(2, 4);
ds.setParameters(P);
// Where to compute the trajectory
uu::TrajectoryDSGenerator::TimeStamps T;
T = ds.generateTimeStamps(0.0, 10.0, 0.1);
// Generate the sample trajectory at the given timestamps
uu::VectorTrajectory Tr(2);
uu::TimedVector xic(0.0, x0);
Tr = ds.generate(xic, T);
// Store the sample trajectory
std::ofstream ofd;
ofd.open("sample.traj");
ofd << Tr;
ofd.close();
std::cout << "Trajectory Saved" << std::endl;
// Now read the sample trajectory from the file
std::ifstream ifd;
uu::VectorTrajectory iTr(2);
ifd.open("sample.traj");
ifd >> iTr;
ifd.close();
std::cout << "Trajectory Loaded" << std::endl;
// Vector with the initial guess of the parameters
uu::Vector P0(4);
P0.set(0, 10);
P0.set(1, 5);
P0.set(2, 20);
P0.set(3, 2);
// P0 = P;
//P0.set(0, 5);
uu::TrajectoryDSGenerator ods(2, 4);
uu::DSAdjust adj(&ods, P0);
std::cout << "Added sample trajectory" << std::endl;
adj.addSampleTrajectory(iTr);
std::cout << "Optimising" <<std::endl;
uu::Vector Pf(adj.optimise()); // Learnt parameters from the real trajectory (thing)
// This improves your initial guess of the parameters
std::cout << "Real Parameters: " << P;
std::cout << "Initial guess: " << P0;
std::cout << "Learnt Parameters: " << Pf;
// Generate a trajectory with the learnt parameters
ds.setParameters(Pf);
uu::VectorTrajectory TrPf(2);
x0.set(0, Pf[2]);
x0.set(1, Pf[3]);
uu::TimedVector xic1(0.0, x0);
TrPf = ds.generate(xic1, T);
// Store the trajectory with the improved guess of the parameters
ofd.open("result.traj");
ofd << TrPf;
ofd.close();
std::cout << "Trajectory Saved" << std::endl;
return 0;
}
答案 0 :(得分:5)
同样的事发生在我身上。解决这个问题:
问题解决了!
答案 1 :(得分:0)
1-转到&#34;项目&#34;顶部的标签
2-选择&#34;属性&#34;
3-选择&#34;构建目标&#34;标签 4-选择&#34;调试&#34;在左边
5-选择&#34;键入:&#34;,选择您想要的任何内容&#34;仅限命令&#34;。如果您不知道该选择什么,请选择&#34; GUI&#34; (对于隐藏的应用程序)或&#34;控制台&#34; (对于控制台窗口应用程序)
6-选择&#34;发布&#34;在左边
7-重复步骤5