For school, we use C++ as the language of choice. I am currently using QtCreator as an IDE, and for its GUI library, it is wonderful. The school is using Visual Studio.
However, most of the programs we are writing make use of cin and cout for input/output. cout works fine as output, as you can see what it puts out in the application output, but there is no way to provide to cin as if it were on a console, like Visual Studio uses for its C++.
An example:
#include <iostream>
#include <string>
using namespace std;
int main() {
string name;
cout << "Enter name: ";
cin >> name;
cout << "Your name is " << name << endl;
}
Is there a way to use a console or provide input to cin like in Visual Studio?
I am currently running OS X Leopard, if it matters.
Qt Creator is a cross-platform (Windows, Linux, Mac) IDE that is part of the Qt SDK and is aimed at simplifying the development of cross-platform GUI applications. It is mostly used with C++ (especially with embedded devices that require UI front), but also with JavaScript and QML.
In the end it comes down to preferences if you want to use Qt Creator or Visual Studio for development. It is easy to create a VS project file from Qt project files using qmake. I prefer using Qt Creator because I can navigate a lot faster. My colleague, however, uses Visual Studio.
Qt Creator is just an IDE used to build QT applications; both Qt Widgets and Qt Quick can be composed. When writing Qt Widgets applications you can edit your GUI in Qt Designer but in case of Qt Quick applications you use Qt Quick Designer, both integrated into Qt Creator.
For console applications, check the Run in terminal check box. To specify the terminal to use on Linux and macOS, select Edit > Preferences > Environment > System. To run with special environment variables set up, select them in the Run Environment section. For more information, see Selecting the Run Environment.
In Preferences, under the Environment section, set the "Terminal" option to /Applications/Utilities/Terminal.app
, as pointed out by Alex Martelli.
Then, in the Projects tab, under Run Settings, check the box marked "Run in Terminal".
Now, QtCreator will use Apple's built-in Terminal.app instead of Qt's console, allowing for interactive input.
If you're doing "console"-style apps with no GUI, Qt Creator may not be the most appropriate IDE -- why not try Apple's own XCode, which probably comes on your OS DVD (as a separate installer), and worst-case can be freely downloaded by registering at Apple Developer Connection?
Edit: as the OP indicates that all they need is the location to Mac's terminal app, that's easy: it's /Applications/Utilities/Terminal.app
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With