LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-28-2012, 12:02 PM   #1
EpicViTTo
LQ Newbie
 
Registered: Aug 2012
Location: Phoenix, Arizona
Distribution: Slackware
Posts: 11

Rep: Reputation: Disabled
Qt application wont run in terminal "Permision denied" even as root user (noob @ qt)


Hello all, it has been a while since i last used this forum...
i am currently running the latest Mint distro and i am very interested in the QT dev kit that i have recently just discovered. I have decent skill with c++ and i have programmed in the terminal before and i really enjoy it. however with my freshly installed Linux Mint i can't get c++ projects to compile. The behavior i get is that the compiler isn't reading my #include lines correctly. it always crashes and reports that all my objects in main are unidefined references. I have looked but i can't find anything that solves this. Is there something about Mint thats different from other distros when it comes to compiling code?

oops... i'm the OP and im already of topic lol I was trying to compile an extremly basic qt example from a book but everytime i try i get "permision denied" i have tried running it from root and i reinstalled qt on as both my standard account and as the root user and i always get the same thing..

here is the code example i am using..
Code:
#include <QApplication>
#include <QLabel>

int main( int argc, char *argv[] )
{
     QApplication app( argc, argv );
     QLabel *label = new QLabel( "Hello World with QT!" );
     label->show( );
     delete label;
     return app.exec( );
}
as i said its a really basic example... these are the commands i'm using to compile and run the program:

qmake -project // because the book told me to.
qmake HelloWorld.pro // because apparently the .pro file was made by the previous //command.
./HelloWorld // the book doesn't explain this part for linux so i tried this &&
./HelloWorld.pro //&&
./HelloWorld.cpp

but they all return the permission denied thing... i consider myself a decent c++ programmer but this enviorment is still fairly new to me and i am very lost... i hope my rambling makes sense to more than just me i have been awake far to long lol any help or tips would be really apreciated thanks
 
Old 11-28-2012, 12:09 PM   #2
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,768

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Have you tried `chmod 755 HelloWorld.cpp`?
 
Old 11-28-2012, 12:21 PM   #3
EpicViTTo
LQ Newbie
 
Registered: Aug 2012
Location: Phoenix, Arizona
Distribution: Slackware
Posts: 11

Original Poster
Rep: Reputation: Disabled
i tried that it got rid of the permission thing but now it says:

./HelloWorld.cpp: line 4: syntax error near unexpected token '('
./HelloWorld.cpp line 4: int main(int argc, char *argv[])'

not sure what that means since im sure that "(" needs to be there and there are no errors that i can see around that area...

what does the chmod 755 command do exactly?
 
Old 11-28-2012, 01:05 PM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,987

Rep: Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611
The "qmake procedure" is :

1) qmake -project ( Creates <Folder-name>.pro )
2) qmake ( Creates a Makefile )
3) make ( Creates the executable e.g. HelloWorld )
4) ./HelloWorld : Runs the applications.



.
 
Old 11-28-2012, 01:12 PM   #5
EpicViTTo
LQ Newbie
 
Registered: Aug 2012
Location: Phoenix, Arizona
Distribution: Slackware
Posts: 11

Original Poster
Rep: Reputation: Disabled
Thank you for writting that out for me the book does a terrible job of explaining things so far. i followed that order and the terminal says:

HelloWorld: cannot connect to X server

im not at all familiar with what this means but it seems like im getting closer to getting this thing working ( finally )

is X server reffering to the GUI part of Linux Mint?

I did some research and found this link:

http://stackoverflow.com/questions/6...qt-application

it explains that the most common reason for the X server error is that the display is not set to the current enviorment. the best wa to fix this according to the link is to type this command,

export DISPLAY=:0.0

before the

./HelloWorld

command

hopefully this question can help someone else as well now.

Thanks soooo much to everyone who helped sove this problem

Last edited by EpicViTTo; 11-28-2012 at 03:05 PM. Reason: found a solution
 
  


Reply

Tags
c++, compilation, mint, qt, terminal


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] "su: must be run from a terminal" How best for root to run command as user simonb Linux - Newbie 1 04-01-2012 02:40 AM
MySQL-phpmyadmin help: "access denied for user root" roboticist Linux - Server 3 02-27-2012 08:01 AM
why I got "Access denied for user: 'root@localhost'" likedreamer Red Hat 1 11-09-2003 05:06 AM
Permission denied on " ls "for root user itsjvivek Linux - General 12 12-11-2002 07:02 PM
su wont work, cant "su root" as a normal user lukeorun Linux - General 5 10-17-2002 07:25 AM


All times are GMT -5. The time now is 08:39 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration