This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Author Message
Joined: Jan 19, 2009
Posts: 29
Other Topics
Posted Jan 19, 2009 at 1:35:06 AM
Subject: Code Blocks in Ubuntu 8.10 showing error
Hi Guys, I am using Ubuntu 8.10 and decided to learn C programming language and installed code blocks for compiling c. I just started with simple programme when i compile it doesnt show any error but when i try to run the programme it shows error like this "sh. /pathname/filename : Permission Denied" popping up in the window then it shows "Press Enter to continue" when i press enter the dos window goes off how to solve this.Thanks in advance.
Back to top Profile Email Website
Rubberman
Joined Jul 30, 2007
Posts: 943
Location:40 miles west of Chicago

Other Topics
Posted: Jan 19, 2009 1:50:11 AM
Subject: Code Blocks in Ubuntu 8.10 showing error
DOS window? Do you mean the terminal (command-line) window? Also, it is possible that for some reason the file permissions were not set for you to run the resulting executable. Why are you not running the native GNU C compiler gcc?

Sometimes real fast is almost as good as real time. Remember, Google is your friend!

Back to top Profile Email Website AOL Instant Messenger
Mohamed Fahim
Joined Jan 19, 2009
Posts: 29

Other Topics
Posted: Jan 19, 2009 2:01:21 AM
Subject: Code Blocks in Ubuntu 8.10 showing error
Hi Rubberman, Thanks for your reply i am saying the terminal which showing the errors in ubuntu can you tell me how to set the file permission. I am not so familiar with gnu c compiler gcc will it be as easy as code blocks please let me know so that i can try gcc one. Thanks in advance
Back to top Profile Email Website
proopnarine

Joined Apr 03, 2008
Posts: 590
Location:San Francisco

Other Topics
Posted: Jan 19, 2009 3:43:08 AM
Subject: Code Blocks in Ubuntu 8.10 showing error
Hi Mohamed. There might not be any problems with your compile, since no errors were given during compilation. Are you using the gcc compiler? Check the permissions of the program with ls -l Somewhere in the permissions block (first colum of the output), there should be one of more "x", meaning that the file is executable. If not, then type chmod +x <filename> and try to run it again. If this works, then for some reason the compilation is not setting the output as executable.

Take the red pill

Climate Change Blog

Food Weblog

Back to top Profile Email Website
Rubberman
Joined Jul 30, 2007
Posts: 943
Location:40 miles west of Chicago

Other Topics
Posted: Jan 20, 2009 4:28:21 AM
Subject: Code Blocks in Ubuntu 8.10 showing error
Sorry Mohamed, but I am not at all familiar with Code Blocks. I'll do some investigating and get back to you. For your information, gcc is a standards-based C and C++ (as well as Java, Fortran, and other) language compiler. It is supported by the Free Software Foundation's GNU project(s). It is probably the best compiler and cross-compiler currently available. I have worked with many, including Visual C/C++ as weil as the vendor compilers available for Solaris, AIX, HPUX, DEC Tru64 Unix, QNX, Watcom, Borland, and others. Most of their senior compiler engineers know me well as I have uncovered a host of compiler bugs on each of them over my 25+ year career in the development of cross-platform applications. So, if you are using a make file for your compilation, you can simply add the rule CC=gcc and CPP=g++ to your makefile in order to make it use the GNU compilers (assuming your build commands are of the form: $(CC) ... or $(CPP) ...). Confused yet? :-) Sorry, but make files and make variables are a standard component of Linux/Unix software development. If you are not familiar with the terminology I am using here, you need to get a book on Make and/or GMake. Check out Amazon.com. As for "best" compilers, there are specialized language compilers that are better than GNU tools for very specialized situations. However, I don't think you are in need of such tools at this point in your career, at least as I can make it out. Even the engineers and scientists that write C/C++ code for HEP (High Energy Physics) primarily use GNU compilers and Linux for their work.

Sometimes real fast is almost as good as real time. Remember, Google is your friend!

Back to top Profile Email Website AOL Instant Messenger
Rubberman
Joined Jul 30, 2007
Posts: 943
Location:40 miles west of Chicago

Other Topics
Posted: Jan 20, 2009 4:33:32 AM
Subject: Code Blocks in Ubuntu 8.10 showing error
Ok, here's what I have found [quote=Wikipedia]Code::Blocks is a free/open source, cross platform IDE. It is developed in C++ using wxWidgets as the GUI toolkit. Using a plugin architecture, its capabilities and features are defined by the provided plugins. Currently, Code::Blocks is oriented towards C/C++. The first stable release was finally made on February 28, 2008, with the version number changed to 8.02. The versioning scheme was changed to that of Ubuntu, with the major and minor number representing the year and month of the release.[/quote] So, my next question. What version of Code::Blocks are you using?

Sometimes real fast is almost as good as real time. Remember, Google is your friend!

Back to top Profile Email Website AOL Instant Messenger
Mohamed Fahim
Joined Jan 19, 2009
Posts: 29

Other Topics
Posted: Jan 21, 2009 7:00:55 AM
Subject: Code Blocks in Ubuntu 8.10 showing error
Thank you Rubberman i am using Code Blocks 8.02 i will try changing the makefile CC=gcc and let you know the outcome.
Back to top Profile Email Website
Rubberman
Joined Jul 30, 2007
Posts: 943
Location:40 miles west of Chicago

Other Topics
Posted: Jan 22, 2009 2:37:55 AM
Subject: Code Blocks in Ubuntu 8.10 showing error
From what I found, I think they are using gcc. What did you find in your Makefile for the CC variable?

Sometimes real fast is almost as good as real time. Remember, Google is your friend!

Back to top Profile Email Website AOL Instant Messenger
Rubberman
Joined Jul 30, 2007
Posts: 943
Location:40 miles west of Chicago

Other Topics
Posted: Jan 22, 2009 2:39:16 AM
Subject: Code Blocks in Ubuntu 8.10 showing error
Also, on my system cc is just a symbolic link to gcc, so it really shouldn't matter. I suspect that Ubuntu works the same way. Request: Please post some of the error messages you are getting in Code Blocks. That would help us determine what you need to do to fix the problem, or at least to get you pointed in the right direction. And please, be specific, not generic like you showed in your first post. Thanks. [Modified by: Rubberman on January 21, 2009 08:41 PM]

Sometimes real fast is almost as good as real time. Remember, Google is your friend!

Back to top Profile Email Website AOL Instant Messenger
Mohamed Fahim
Joined Jan 19, 2009
Posts: 29

Other Topics
Posted: Jan 26, 2009 8:52:22 AM
Subject: Code Blocks in Ubuntu 8.10 showing error
Hi Rubberman, I just try to compile a simple programme in C languague using code blocks under Ubuntu 8.10. The errors i got in terminal is "sh: /home/path_name/programme_name: Programme denied" how to rectify it i also tried by using CC=gcc then also same error in my code blocks under settings "shell to run commands = /bin/bash -c" and in Terminal to launch console programmes = xterm -T $TITLE -e. can you let me know how to rectify the error. Thanks in advance.
Back to top Profile Email Website
Mohamed Fahim
Joined Jan 19, 2009
Posts: 29

Other Topics
Posted: Jan 26, 2009 8:54:05 AM
Subject: Code Blocks in Ubuntu 8.10 showing error
Hi Rubberman, In my previous post i posted it as "Programme denied" sorry for typing wrongly it is "Permission denied"
Back to top Profile Email Website
Rubberman
Joined Jul 30, 2007
Posts: 943
Location:40 miles west of Chicago

Other Topics
Posted: Jan 26, 2009 4:17:43 PM
Subject: Code Blocks in Ubuntu 8.10 showing error
Try setting the permissions on the file from a command line terminal window: sudo chmod ugo+rwx filename It may be that the executable either did not get its execute permissions set, or that the owner is not your account and the read/execute permissions for Others is not set (the o in ugo). This will make the file readable/writeable/executable by anyone on the system - a security flaw to be sure, but fine for testing this program. If this works, then I don't know why it is happening, unless CodeBlocks is owned by root (probably) and its setuid bit is enabled, in which case it will execute as root and all files it creates will be also owned by root.

Sometimes real fast is almost as good as real time. Remember, Google is your friend!

Back to top Profile Email Website AOL Instant Messenger
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya