Results 1 to 13 of 13

Thread: Using the standard library with qt creator

  1. #1
    Join Date
    Feb 2009
    Posts
    13
    Thanks
    5
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Using the standard library with qt creator

    So i'm just learning to program with C++ (hoping to program with qt eventually) and I decided that I would try using the qt creator's code editor. However, the editor says that the standard library headers are non-existant, even though I can compile my programs just fine using terminal. (i'm on a mac) I was just wondering if there was a way to remedy this so I can run my programs in qt creator. I am asumming there is a file path that the editor is looking for them in and it cannot find them. Any help would be great.

  2. #2
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Using the standard library with qt creator

    If you want others to help you you need to be more specific. Show us code, the instructions how did you try to compile it in Qt Creator and in terminal, error output, all possible information.
    Last edited by lyuts; 21st May 2009 at 09:30.
    I'm a rebel in the S.D.G.

  3. #3
    Join Date
    Feb 2009
    Posts
    13
    Thanks
    5
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Using the standard library with qt creator

    OK I guess that my first post was a little wordy so I'll just get to the point. Why does the Qt creator not find the standard library headers when you try to use them. Eg:
    Qt Code:
    1. #include <iostream>
    2. #include <string>
    3. #include <stdexcept>
    4. #inlcude <vector>
    To copy to clipboard, switch view to plain text mode 
    all these preprocessor directives get little squiggly red lines under them and if you hover over it the tool tip says "No such file or directory"

    What I want to know is where the directory that Qt creator is looking in for these libraries in is so I can add the standard library files. All I want to do is be able to hit the run button and have my program work. Btw, I just opened my .cpp file with qt creator I have no project file.

    EDIT: I put my code into the main.cpp generated when I make a Qt console application project (in place of generated code), ran the program and it did everything right until I tried to input something and
    Qt Code:
    1. std::cin >> n1;
    To copy to clipboard, switch view to plain text mode 
    wouldn't read my input, I just hit enter and nothing happened. (this is in the program output pane of Qt creator) is there no way to give a program you are running input like you would if it was complied and run in terminal?
    Last edited by DragonLance156156; 22nd May 2009 at 07:36.

  4. #4
    Join Date
    Jul 2009
    Posts
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Using the standard library with qt creator

    I have the same problem. Program compiles, but includes are highlighted with warning and completion for standard c++ library does not work.

    Update: solved by adding
    Qt Code:
    1. INCLUDEPATH += /usr/include/c++/4.3
    To copy to clipboard, switch view to plain text mode 
    to .pro file. Currently have no idea how to not use absolute path there.
    Last edited by kolen; 2nd July 2009 at 19:39.

  5. The following user says thank you to kolen for this useful post:

    SiL3NC3 (28th November 2012)

  6. #5
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Thumbs up Re: Using the standard library with qt creator

    thank you dude, was already wondering while learning c++ with qt creator ...

    *thumbsup*

  7. #6
    Join Date
    Feb 2013
    Posts
    38
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Using the standard library with qt creator

    Hi !

    I tried the same include (with a version 4.6) but Qt Creator still don't get the standard c++ includes.

    Any ideas ?

    I was previously working on Windows and I am now on an Ubuntu. I tried before on a VM and it worked fine. So I assume it is because of the new machine configurations...I don't know where to look

  8. #7
    Join Date
    Feb 2013
    Posts
    38
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Using the standard library with qt creator

    It compiles fine but it indicates that the includes point to nothing existing...and I have no autocompletion

  9. #8
    Join Date
    Oct 2012
    Posts
    132
    Thanks
    10
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Using the standard library with qt creator

    Does the problem occur on Windows or on Ubuntu (or on both systems)?

    If the problem occurs only on Windows and you are using MinGW: I had the same problem, my program compiled fine but the header files of the standard library couldn't be found (hence auto completion didn't work). I was using MinGW as compiler and I chose mingw32-make.exe as compiler path. Using gcc.exe instead of mingw32-make.exe solved the problem. Maybe this works for you, too.

  10. #9
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Using the standard library with qt creator

    Quote Originally Posted by Infinity View Post
    I was using MinGW as compiler and I chose mingw32-make.exe as compiler path.
    Why, it is certainly not a C++ compiler.

  11. #10
    Join Date
    Feb 2013
    Posts
    38
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Using the standard library with qt creator

    May it be because it is not in the environment ?

    In the PATH variable I do not have /usr/include/c++/4.6.

  12. #11
    Join Date
    Oct 2012
    Posts
    132
    Thanks
    10
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Using the standard library with qt creator

    Why, it is certainly not a C++ compiler.
    I know, I chose it accidentally. The compilation worked nevertheless (so I didn't noticed that mistake instantly - only auto completion didn't work).

    May it be because it is not in the environment ?
    Just try to add it.

  13. #12
    Join Date
    Feb 2013
    Posts
    38
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Using the standard library with qt creator

    I added it to the environment PATH variable but it changed nothing.

  14. #13
    Join Date
    Aug 2015
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Smile Re: Using the standard library with qt creator

    On Windows you change environment variables by right clicking My Computer -> Properties -> Advanced -> Environment variables.
    Add D:\Program Files\Qt\5.5
    Works fine for me.

Similar Threads

  1. Extending a plugin in a static library
    By ultim8 in forum Qt Programming
    Replies: 5
    Last Post: 25th March 2010, 16:10
  2. source building a standard gnu library
    By felix in forum Qt Tools
    Replies: 0
    Last Post: 5th March 2009, 18:40
  3. plugin in a library
    By alisami in forum Qt Programming
    Replies: 2
    Last Post: 3rd October 2008, 18:21
  4. Replies: 1
    Last Post: 5th March 2007, 21:50
  5. QProcess +standard error + windows
    By antonio.r.tome in forum Qt Programming
    Replies: 0
    Last Post: 18th April 2006, 15:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.