0

我正在尝试执行以下命令。但是,我遇到了以下错误。

Undefined symbols for architecture x86_64:
"thrust_wrt_world()", referenced from:
   numerical_dynamics() in lander-8358f0.o
"atmospheric_density(vector3d)", referenced from:
    numerical_dynamics() in lander-8358f0.o
"attitude_stabilization()", referenced from:
    numerical_dynamics() in lander-8358f0.o
"_autopilot_enabled", referenced from:
  numerical_dynamics() in lander-8358f0.o
  initialize_simulation() in lander-8358f0.o
"_delta_t", referenced from:
  numerical_dynamics() in lander-8358f0.o
  initialize_simulation() in lander-8358f0.o
"_fuel", referenced from:
  numerical_dynamics() in lander-8358f0.o
"_main", referenced from:
 implicit entry/start for main executable
"_orientation", referenced from:
  initialize_simulation() in lander-8358f0.o
"_parachute_status", referenced from:
  initialize_simulation() in lander-8358f0.o
"_position", referenced from:
  numerical_dynamics() in lander-8358f0.o
  initialize_simulation() in lander-8358f0.o
"_scenario", referenced from:
  initialize_simulation() in lander-8358f0.o
"_scenario_description", referenced from:
  initialize_simulation() in lander-8358f0.o
"_stabilized_attitude", referenced from:
  numerical_dynamics() in lander-8358f0.o
  initialize_simulation() in lander-8358f0.o
"_velocity", referenced from:
  numerical_dynamics() in lander-8358f0.o
  initialize_simulation() in lander-8358f0.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see 
invocation)

所有变量都在一个单独的文件中定义,所以看起来没问题。以上是命令行显示的完整错误。我已包含完整的错误以供参考。

void numerical_dynamics (void)
// This is the function that performs the numerical integration to update the
// lander's pose. The time step is delta_t (global variable).
{

    double parach_area=pow(2.0*LANDER_SIZE,2)*5;
    double abspos=position.abs();
    double absvel=velocity.abs();

    vector3d thr=thrust_wrt_world();
    vector3d velnorm=velocity.norm();
    vector3d posnorm=position.norm();

    double masslander=UNLOADED_LANDER_MASS+fuel*FUEL_CAPACITY*FUEL_DENSITY;
    vector3d gravity=-GRAVITY*MARS_MASS*masslander*posnorm/pow(abspos,3);
    vector3d drag=-0.5*atmospheric_density(position)*DRAG_COEF_LANDER*parach_area*pow(absvel,2)*velnorm;
    vector3d acceleration=(gravity+drag+thr)/masslander;
    position=position+delta_t*velocity;
    velocity=velocity+delta_t*acceleration;

    // Here we can apply an autopilot to adjust the thrust, parachute and attitude
    if (autopilot_enabled) autopilot();

    // Here we can apply 3-axis stabilization to ensure the base is always pointing downwards
    if (stabilized_attitude) attitude_stabilization();
}
4

0 回答 0