Skip to content

FGFDMExec class seems to break when placed in a C++ array or vector #999

Answered by scotteh432
scotteh432 asked this question in Q&A
Discussion options

You must be logged in to vote

Fixed it. After reading the link above I understand a little bit better about the distinctions between pointing reference, and copying. Pre-initializing the vector solved the issue.

  std::vector < JSBSim::FGFDMExec> vectorOfFdms(aircraftFolders.size());
  for (size_t i = 0; i < aircraftFolders.size(); ++i) {
    vectorOfFdms[i].SetDebugLevel(0);
    vectorOfFdms[i].SetAircraftPath(SGPath(aircraftFolders[i]));
    vectorOfFdms[i].SetSystemsPath(SGPath(systemFolders[i]));
    vectorOfFdms[i].SetEnginePath(SGPath(engineFolders[i]));
    vectorOfFdms[i].SetOutputPath(SGPath(outputFolders[i]));
    vectorOfFdms[i].LoadScript(SGPath(scriptFiles[i]));
    vectorOfFdms[i].Setdt(timeStepSize);
  }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@scotteh432
Comment options

Answer selected by scotteh432
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants