How to run a C++ code in Qt?



  • Hi, the previous error was solved. I wanted to have a C++ code results in widget. For reminding in brief, I created a Qt widget project, and I added the C++ code including header and source files to the project. I copied the main.cpp C++ codes in the Qt main.cpp file.

    The error was ```

    void PS... (char *)': cannot convert argument 1 from 'const char [37]' to 'char *
    

    I changed the definition of the function:

    void PS... (char *_sth)
    

    to

    void PS... (const char *_sth) 
    

    and it doesn't give the error. But, now I want to have some values as result in Application Output , but instead of the non-zero values, they are all zero.
    The input data are read from a model.txt file. The path of the text file was also added in the "project" > run of "Desktop Qt 5.6 MSVC2015 64 bit" > "Arguments". Do you know if it is related to the reading input data or not?


  • Qt Champions 2018

    How do you read model.txt file?
    Is this file found?
    Do you have any errors while reading it?
    Why don't just debug and see what happens?



  • @jsulm
    In the code, it read using ```

    bool ReadModelData(istream &in, functionname &_PS) ...
    ...
    ReadModelData (fin,s)
    ...
    

    The path of the text file was added in the "project" > run of "Desktop Qt 5.6 MSVC2015 64 bit" > "Arguments". File path
    When I debug it just show in the Application output:

    Debugging starts
    Debugging has finished
    

    and when run the code the results are cpu=0 z=0 ... while they should be some non-zero.


Log in to reply