Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Sometimes <iostream> found and compiles and sometimes not!
Forum Updated to NodeBB v4.3 + New Features

Sometimes <iostream> found and compiles and sometimes not!

Scheduled Pinned Locked Moved Solved General and Desktop
26 Posts 3 Posters 14.1k Views 1 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.
  • A Offline
    A Offline
    andreyc
    wrote on last edited by
    #2

    Do you use qmake to generate Makefiles ?
    Do you use the same qmake ?
    What is a compiler command line for both cases ?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      BOHICAMAN
      wrote on last edited by
      #3

      For both I used Qt Creator (ver 3.1.1 that came w/Qt 5.3) not the Command Line version. The compiler used is the default listed in the "kit":

      Desktop Qt5.3.0MSVC2013OpenGL64bit

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andreyc
        wrote on last edited by
        #4

        When you run build in QtCreator it prints all output from qmake and make into "Compile output" panel at the bottom of a screen.
        You can find "Ctrl+F" the exact compiler line that generates an error and compare it with a good behaving program.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          BOHICAMAN
          wrote on last edited by
          #5

          Unfortunately, most of it is still new to me!! Compile Output shows the following:

          @16:09:00: Running steps for project VehicleClass...
          16:09:00: Configuration unchanged, skipping qmake step.
          16:09:00: Starting: "C:\Qt\Qt5.3.0\Tools\QtCreator\bin\jom.exe"
          C:\Qt\Qt5.3.0\Tools\QtCreator\bin\jom.exe -f Makefile.Release
          cl -c -nologo -Zm200 -Zc:wchar_t -FS -O2 -MD -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DWIN64 -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -I"C:\Qt\Qt5.3.0\5.3\msvc2013_64_opengl\include" -I"C:\Qt\Qt5.3.0\5.3\msvc2013_64_opengl\include\QtCore" -I"release" -I"." -I"C:\Qt\Qt5.3.0\5.3\msvc2013_64_opengl\mkspecs\win32-msvc2013" -Forelease\ @C:\Users\ROBERT~1.CRE\AppData\Local\Temp\main.obj.9732.16.jom
          main.cpp
          ..\VehicleClass\main.cpp(3) : fatal error C1083: Cannot open include file: 'iostream': No such file or directory
          jom: D:\Qt GUI Projects\Tutorial Projects\build-VehicleClass-Desktop_Qt_5_3_0_MSVC2013_OpenGL_64bit-Release\Makefile.Release [release\main.obj] Error 2
          jom: D:\Qt GUI Projects\Tutorial Projects\build-VehicleClass-Desktop_Qt_5_3_0_MSVC2013_OpenGL_64bit-Release\Makefile [release] Error 2
          16:09:01: The process "C:\Qt\Qt5.3.0\Tools\QtCreator\bin\jom.exe" exited with code 2.
          Error while building/deploying project VehicleClass (kit: Desktop Qt 5.3.0 MSVC2013 OpenGL 64bit)
          When executing step 'Make'
          16:09:01: Elapsed time: 00:01.@

          The error shows up in .cpp file on line 3 and is only one. Just can't find <iostream>

          1 Reply Last reply
          0
          • B Offline
            B Offline
            BOHICAMAN
            wrote on last edited by
            #6

            Here's the compiler output from the good program:

            @16:15:16: Running steps for project HelpClass...
            16:15:16: Configuration unchanged, skipping qmake step.
            16:15:16: Starting: "C:\Qt\Qt5.3.0\Tools\QtCreator\bin\jom.exe"
            C:\Qt\Qt5.3.0\Tools\QtCreator\bin\jom.exe -f Makefile.Release
            16:15:16: The process "C:\Qt\Qt5.3.0\Tools\QtCreator\bin\jom.exe" exited normally.
            16:15:16: Elapsed time: 00:00.@

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andreyc
              wrote on last edited by
              #7

              Could you add an output of good compile log from other program.
              And how do you include iostream in both cases

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andreyc
                wrote on last edited by
                #8

                Could you rebuild good program.
                Right click on it in Project view and select "Rebuild".

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  BOHICAMAN
                  wrote on last edited by
                  #9

                  Here's part of the coding from the "bad" program
                  @// A program that uses the Vehicle CLASS.

                  #include <iostream>

                  using namespace std;

                  //Declare the Vehicle Class.
                  class Vehicle {
                  public:
                  int passengers; //number of passengers.
                  int fuelcap; //fuel capacity.
                  int mpg; //fuel consumption in mpg.
                  };

                  int main() /The main() function creates 2 instances of Vehicle called minivan and sportscar.
                  The code within main() accesses the instances of variables associated
                  with minivan & sportscar, assigning them values and then using those variables.
                  The code inside main() can access the members of Vehicle because they add_reference
                  declared public.
                  /

                  {@

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    BOHICAMAN
                    wrote on last edited by
                    #10

                    And part from the "good one"

                    @/*

                    • A simple program to provide Help with functions.

                    • Project 3-3 Pg 111 is herein revised to Project HelpClass Pg 295 (C++ A Beginner's Guide) with addition of USER ID function

                    • from Masteryhecks 8

                    • This Help System now processes multiple requests.

                    • This main.cpp adds a User ID function to the original program on Pg 295
                      */

                    #include <iostream>
                    using namespace std;

                                                            // A class that encapsulates a help system. This is a function only class.
                    

                    class Help {
                    int userID;

                    public:
                    Help(int id) { userID = id; } //Sert up User ID

                    ~Help() { cout << "\n Terminating help for # " <<
                                      userID << ".\n\n";}
                    int getID() { return userID; }
                    
                    void helpon(char what);
                    void showmenu();
                    bool isvalid(char ch);
                    

                    };
                    //Display help information.

                    void Help::helpon(char what)
                    {
                    switch (what)
                    {
                      case '1' :
                       cout << " The if:\n\n" ;
                       cout << " if(condition) statement; /n" ;
                       cout << " else statement; \n" ;
                        break ;@
                    
                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      andreyc
                      wrote on last edited by
                      #11

                      Are there any differences in the .pro files except of different source files ?

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        BOHICAMAN
                        wrote on last edited by
                        #12

                        Nope, identical.

                        1 Reply Last reply
                        0
                        • B Offline
                          B Offline
                          BOHICAMAN
                          wrote on last edited by
                          #13

                          Bad .pro
                          @
                          #-------------------------------------------------

                          Project created by QtCreator 2014-06-26T11:23:54

                          #-------------------------------------------------

                          QT += core

                          QT -= gui

                          TARGET = VehicleClass
                          CONFIG += console
                          CONFIG -= app_bundle

                          TEMPLATE = app

                          SOURCES += main.cpp
                          @


                          Good .pro
                          @
                          #-------------------------------------------------

                          Project created by QtCreator 2014-06-26T14:16:26

                          #-------------------------------------------------

                          QT += core

                          QT -= gui

                          TARGET = HelpClass
                          CONFIG += console
                          CONFIG -= app_bundle

                          TEMPLATE = app

                          SOURCES += main.cpp
                          @

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            andreyc
                            wrote on last edited by
                            #14

                            What if you try to run "Clean", "Run qmake", and "Rebuild" for both projects.

                            1 Reply Last reply
                            0
                            • B Offline
                              B Offline
                              BOHICAMAN
                              wrote on last edited by
                              #15

                              Didn't work. Now neither compiles. I get that same error message for both. No idea what's wrong!!

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                andreyc
                                wrote on last edited by
                                #16

                                Do you have iostream file on your computer ?

                                [EDIT] What version of Qt do you use ?

                                1 Reply Last reply
                                0
                                • B Offline
                                  B Offline
                                  BOHICAMAN
                                  wrote on last edited by
                                  #17

                                  Yea, looked it up and it's in the "include" folder of MSVC2013

                                  Qt 5.3.0 using QtCreator 3.1.1

                                  It's been working fine till today. Haven't added any new programs, updates, etc. Nothings changed that I know of. Also checked and no viruses according to Norton!

                                  1 Reply Last reply
                                  0
                                  • B Offline
                                    B Offline
                                    BOHICAMAN
                                    wrote on last edited by
                                    #18

                                    Also, the "good" program was re-compiling until just now. Beats me what's going on!!

                                    1 Reply Last reply
                                    0
                                    • B Offline
                                      B Offline
                                      BOHICAMAN
                                      wrote on last edited by
                                      #19

                                      I've got to head to a meeting now. I really appreciate all your help and assistance!! If you think of anything else, I'll be checking in later. Again, thanks!!

                                      Bob

                                      1 Reply Last reply
                                      0
                                      • A Offline
                                        A Offline
                                        andreyc
                                        wrote on last edited by
                                        #20

                                        Try to add to you .pro file
                                        @
                                        INCLUDEPATH += C:/path/to/MSVC2013/include
                                        DEPENDPATH += C:/path/to/MSVC2013/include
                                        @

                                        1 Reply Last reply
                                        0
                                        • B Offline
                                          B Offline
                                          BOHICAMAN
                                          wrote on last edited by
                                          #21

                                          Nope, didn't work.

                                          1 Reply Last reply
                                          0

                                          • Login

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