您必须选择主机应用程序才能运行仅命令目标? Code :: Blocks [英] You must select a host application to run a commands only target? Code::Blocks

查看:2954
本文介绍了您必须选择主机应用程序才能运行仅命令目标? Code :: Blocks的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行我的代码,它编译良好没有错误,并用于发送输出到终端,但现在给我一个提示您必须选择一个主机应用程序运行a commands only target

I'm running my code and it compiles fine with no errors, and used to send an output to the terminal, however it now gives me a prompt saying You must select a host application to "run" a commands only target.

我不知道我做了什么,我从来没有遇到过这种情况。有任何想法如何选择正确的主机应用程序?

I don't know what I've done, and I have never come across this before. Has anyone any ideas how to select the correct host application?

任何帮助是非常感谢,感谢一百万。

Any help is much appreciated, thanks a million.

这是一个 test.cc 文件代码,我试图运行。

Here's a test.cc file code that I'm trying to run.

#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;
}


推荐答案

。要解决此问题:


  • 转到项目 - >属性


  • 前往建立目标分页


  • 下拉框到控制台应用


  • (可选)选中执行结束时暂停
  • (Optional) Check the box "Pause when execution ends" if you don't want the terminal window to instantly close when it pops up


  • 点击 ..,选择要运行的输出文件,然后单击保存。如果弹出框要求替换文件,请替换。

问题解决了!

这篇关于您必须选择主机应用程序才能运行仅命令目标? Code :: Blocks的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆