我正在运行我的代码,它编译没有错误,并用于发送输出到终端,但它现在给我一个提示说You must select a host application to "run" a commands only target
。您必须选择一个主机应用程序才能运行一个仅限命令的目标? Code :: Blocks
我不知道我做了什么,我从来没有遇到过这个。有没有人有任何想法如何选择正确的主机应用程序?
任何帮助非常感谢,感谢一百万。
这是我试图运行的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;
}
请包括您正在测试的代码块,以及您可以做的关于您期望它做什么的最佳分析,错误以及它发生的位置。谢谢,欢迎来到SO。 :) – canolucas 2014-08-30 20:22:43
感谢@canolucas,我编辑了我的上述问题,以显示我正在尝试运行的测试代码。基本上它被分成3个主要部分,一个初始轨迹,一个轨迹猜测,然后它使用优化函数来创建更准确的猜测参数版本。所以我希望它基本上向命令行显示值。希望这可以帮助 – 2014-08-30 21:30:43