Message Board


Message Board > C/C++ > Can't get program to run in Fedora 17

September 20, 2012, 05:20
DoctorN
Whiskered
91 posts
I just installed fedora to a computer, and I ran this code:
Code:
yum install gcc gcc-c++ SDL-devel SDL_mixer-devel SDL_image-devel SDL_ttf-devel bash

and then I compiled a test program like this:
Code:
g++ -o test test.cpp -lSDL -lSDL_image -lSDL_ttf

I am essentially using this tutorial
http://lazyfoo.net/SDL_tutoria … x/cli/index.php
I did try the chmod stuff but nothing worked. I would type in "test", "./test", "bash test", "bash ./test", etc. I either got permission denied or cannot execute binary. Why is it this hard just to do something that windows can do easily? Thanks

P.S. I originally tried help from a bbs, but you can see how retarded it got
http://dis.4chan.org/read/prog/1348101283/1-40

[Edited on September 20, 2012 by DoctorN]
____________
#
September 20, 2012, 20:27
DTM
Earthling!
821 posts

Have you tried something simpler first? Just in case it's any issue with SDL or something.

Code:
#include <stdio.h>

int main(int argc, char **argv)
{
    printf("Wooo\n");
    return 0;    
}


Then compile:
g++ -o test test.cpp

And run:
./test

Personally I use Ubuntu not Fedora though...

You can check permissions of the file to see if the "test" file is actually executable:

ls -lah
Code:
daniel@daniel-laptop:~/Desktop/untitled folder$ ls -lah
total 36K
drwxr-xr-x  2 daniel daniel 4.0K 2012-09-20 19:03 .
drwxr-xr-x 12 daniel daniel 4.0K 2012-09-20 18:59 ..
-rwxr-xr-x  1 daniel daniel 7.1K 2012-09-20 19:03 test
-rw-r--r--  1 daniel daniel   90 2012-09-20 19:03 test.cpp


Notice for each file listed:

- may start with 'd' indicating it is a directory (or '-' if it's a regular file)
- then three sets of permissions, three characters each. For Owner, Group, and Other, in that order. 9 characters in total.

'r' for readable
'w' for writable
'x' for executable (what you are interested in)

So for my test executable above it is listed as "-rwxr-xr-x".

The first three characters 'rwx' mean readable, writable, and executable for the file owner (You, who created it). This is most important; if the 'x' is present there it should mean you will be able to execute it.

The second three chars 'r-x' mean readable, and executable for those in the file's "group" (files can belong to groups, and so can users). Note 'w' is absent, meaning it can't be written by anyone in the group, only the owner can.

The third three chars 'r-x' mean the same as above, but for Other, which means any other users on the system.

You can just run "chmod a+x test" which means the 'x' (executable) flag will be set in all cases. (Giving what you see in my output above)



....


alternatively, just use an IDE like Code::Blocks.. It can be just as easy as windows...
____________
:o
#
September 21, 2012, 04:14
DoctorN
Whiskered
91 posts
nope i keep getting permission denied on bash
____________
#
September 21, 2012, 12:23
DTM
Earthling!
821 posts

Paste the exact error (along with the command you use to run the program) here.

Also paste the output from "ls -lah" in that same directory.
____________
:o
#
September 22, 2012, 07:33
DoctorN
Whiskered
91 posts
that doesnt work in Fedora, I tried the ls -lah thing it didnt know what the -lah is
____________
#
September 22, 2012, 14:14
DTM
Earthling!
821 posts

seriously? and you are typing this in the command line?

Post a screenshot of it not working. POST SOMETHING. ANYTHING. You can't just say "it doesn't work". Post the precise copy and pasted terminal output of it saying it doesn't work.

And read this:
http://www.liberiangeek.net/20 … -for-beginners/
____________
:o
#
September 22, 2012, 19:23
DoctorN
Whiskered
91 posts
http://www.mediafire.com/?tcwawp400m48bfh
____________
#
September 23, 2012, 13:10
DTM
Earthling!
821 posts

Hmm. That's very odd. The chmod doesn't appear to be working and is not setting the file to be executable :S

*googles*

Aha. This might be your problem:
http://ubuntuforums.org/showthread.php?t=1686624

You are working on a USB drive, which probably is formatted for Windows.

So maybe you can work on your local disk instead of the USB drive? Or format the drive to some Linux format. (But then it won't work with Windows any more)
____________
:o
#
September 23, 2012, 17:09
DoctorN
Whiskered
91 posts
the flashdrive was formatted at school on a macintosh

for example, bennuGD works just fine with a flashdrive

it works on the drive itself now, but the problem is the game opens up and then closes right away. It isn't the same program I had posts earlier. Its the animation tutorial from lazyfoo.net.

[Edited on September 23, 2012 by DoctorN]
____________
#

Message Board > C/C++ > Can't get program to run in Fedora 17

Quick reply


You must log in or register to post.
Copyright © 2005 Booleansoup.com
Questions? Comments? Bug reports? Contact us!