Topic
2 replies Latest Post - ‏2013-07-08T15:56:23Z by myrmidon
myrmidon
myrmidon
23 Posts
ACCEPTED ANSWER

Pinned topic Export data to file

‏2013-07-08T14:34:43Z |

Hello,

I would like to export some attribute values in a txt file. I inserted the code in a state but I get quite a few errors. I tried also to include the include files (I do not know if this is needed) in the configuration of my component > Initializatrion code ::  #include <iostream> & #include <fstream> but no result. The code is the following::

ofstream outputFile;
outputFile.open("test.txt");
outputFile << "test success"<< endl;
outputFile.close();

I also tried with std namespace but nothing again. Any ideas?

Thanks a lot!

Updated on 2013-07-08T14:54:52Z at 2013-07-08T14:54:52Z by myrmidon
  • shanz9903
    shanz9903
    261 Posts
    ACCEPTED ANSWER

    Re: Export data to file

    ‏2013-07-08T14:59:06Z  in response to myrmidon

    I normally use ImpIncludes (or SpecIncludes) at the class-level rather than add includes at the config level.

    This seems quite a basic thing.  Have you viewed the generated code?  What are the errors?

    • myrmidon
      myrmidon
      23 Posts
      ACCEPTED ANSWER

      Re: Export data to file

      ‏2013-07-08T15:56:23Z  in response to shanz9903

      Hi thanks for your reply,

      I added the path of #include <iostream> & #include <fstream> in ImpIncludes as you indicates and I just tried this

      std::ofstream outputFile;

      but i get the following linker errors (I use Rhapsody 8 with VS Express 2008)

      error LNK2019 (I do not know if you get something from the following.. it is in french too :S)

      do you have any ideas?

      thanks again

      -----------------------------------

      RhapSFunc_SFunctionBlockISM_MONOATA_TC01_SYS.obj : error LNK2019: symbole externe non résolu "public: int __thiscall ISM_MONOATA_TC01_CON::getCTR_FEED_ERR(void)const " (?getCTR_FEED_ERR@ISM_MONOATA_TC01_CON@@QBEHXZ) référencé dans la fonction "void __cdecl mdlOutputs(struct SimStruct_tag *,int)" (?mdlOutputs@@YAXPAUSimStruct_tag@@H@Z)
      SFunctionBlockISM_MONOATA_TC01_SYS.obj : error LNK2019: symbole externe non résolu "public: void __thiscall ISM_MONOATA_TC01_CON::CTR_FEED_ERR_SP_C::setItsRhpIntegerFlowInterface(class RhpIntegerFlowInterface *)" (?setItsRhpIntegerFlowInterface@CTR_FEED_ERR_SP_C@ISM_MONOATA_TC01_CON@@QAEXPAVRhpIntegerFlowInterface@@@Z) référencé dans la fonction "protected: void __thiscall SFunctionBlockISM_MONOATA_TC01_SYS::initRelations(void)" (?initRelations@SFunctionBlockISM_MONOATA_TC01_SYS@@IAEXXZ)
      SFunctionBlockISM_MONOATA_TC01_SYS.obj : error LNK2019: symbole externe non résolu "public: class ISM_MONOATA_TC01_CON::CTR_FEED_ERR_SP_C * __thiscall ISM_MONOATA_TC01_CON::get_CTR_FEED_ERR_SP(void)const " (?get_CTR_FEED_ERR_SP@ISM_MONOATA_TC01_CON@@QBEPAVCTR_FEED_ERR_SP_C@1@XZ) référencé dans la fonction "protected: void __thiscall SFunctionBlockISM_MONOATA_TC01_SYS::initRelations(void)" (?initRelations@SFunctionBlockISM_MONOATA_TC01_SYS@@IAEXXZ)
      SFunctionBlockISM_MONOATA_TC01_SYS.obj : error LNK2019: symbole externe non résolu "public: virtual __thiscall ISM_MONOATA_TC01_CON::~ISM_MONOATA_TC01_CON(void)" (??1ISM_MONOATA_TC01_CON@@UAE@XZ) référencé dans la fonction __unwindfunclet$??0SFunctionBlockISM_MONOATA_TC01_SYS@@QAE@PAVIOxfActive@@@Z$0
      SFunctionBlockISM_MONOATA_TC01_SYS.obj : error LNK2019: symbole externe non résolu "public: __thiscall ISM_MONOATA_TC01_CON::ISM_MONOATA_TC01_CON(class IOxfActive *)" (??0ISM_MONOATA_TC01_CON@@QAE@PAVIOxfActive@@@Z) référencé dans la fonction "public: __thiscall SFunctionBlockISM_MONOATA_TC01_SYS::SFunctionBlockISM_MONOATA_TC01_SYS(class IOxfActive *)" (??0SFunctionBlockISM_MONOATA_TC01_SYS@@QAE@PAVIOxfActive@@@Z)
      RhapSFunc_SFunctionBlockISM_MONOATA_TC01_SYS.mexw32 : fatal error LNK1120: 5 externes non résolus

      -------------------------------