Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

cannot run applications from Qt creator

$
0
0
Hi all, I have installed Qt on Linux Mint Debian Edition and tried to run an example from C++ GUI Programming with Qt4 2nd edition. From qt-creator, I’m able to compile the code, but when I run it from there, I see the terminal without any message. However, the program runs with no issues and shows the expected output if I run it from the terminal (as a regular user). What’s wrong here? Any help would be much appreciated. Qt Creator 2.5.0 Qt 4.8.2 (64bit) The code code is below semaphores.pro TEMPLATE      = app CONFIG       += console thread CONFIG       -= app_bundle SOURCES       = semaphores.cpp semaphores.cpp #include <QtCore> #include <iostream>   const int DataSize = 100000; const int BufferSize = 4096; char buffer[BufferSize];   QSemaphore freeSpace(BufferSize); QSemaphore usedSpace(0);   class Producer : public QThread {       public:     void run(); };   void Producer::run() {     for (int i = 0; i < DataSize; ++i) {         freeSpace.acquire();         buffer[i % BufferSize] = "ACGT"[uint(std::rand()) % 4];         usedSpace.release();     } }   class Consumer : public QThread { public:     void run(); };   void Consumer::run() {     for (int i = 0; i < DataSize; ++i) {         usedSpace.acquire();         std::cerr << buffer[i % BufferSize];         freeSpace.release();     }     std::cerr << std::endl; }   int main() {     Producer producer;     Consumer consumer;     producer.start();     consumer.start();     producer.wait();     consumer.wait();     return 0; }

Viewing all articles
Browse latest Browse all 18427

Trending Articles