Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to run a C++ code in Qt?
Forum Updated to NodeBB v4.3 + New Features

How to run a C++ code in Qt?

Scheduled Pinned Locked Moved Installation and Deployment
123 Posts 5 Posters 118.0k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rela
    wrote on 29 Mar 2016, 10:45 last edited by Rela
    #121

    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?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 29 Mar 2016, 12:58 last edited by
      #122

      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?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      R 1 Reply Last reply 1 Apr 2016, 11:33
      0
      • J jsulm
        29 Mar 2016, 12:58

        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?

        R Offline
        R Offline
        Rela
        wrote on 1 Apr 2016, 11:33 last edited by
        #123

        @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.

        1 Reply Last reply
        0

        121/123

        29 Mar 2016, 10:45

        • Login

        • Login or register to search.
        121 out of 123
        • First post
          121/123
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved