Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsLinux Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old December 18th, 2002, 11:04 PM
Marky_Mark Marky_Mark is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: On a screen near you
Posts: 498 Marky_Mark User rank is Private First Class (20 - 50 Reputation Level)Marky_Mark User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Linux problems

Ive just installed SuSE 8.1 personal and im a bit miffed because the personal edition doesn't have Apache or PHP in the distro You have to purchase the professional version here in england to get Apache and PHP included


Quite sad really... but apart from that i get most everything else
Anyway my main question is?


I created a simple helloworld.c and compiled it with g++
Everything compiled but when i tried to execute helloworld i got a message "cant execute binary"


The binary file was in a sub dir of /home/c++ and I was root
chmod a+x helloworld


command
$ ./helloworld

error
"cant execute binary"


Anyone know?
__________________
100 trillion calculations per nanosecond

Last edited by Marky_Mark : December 18th, 2002 at 11:06 PM.

Reply With Quote
  #2  
Old December 19th, 2002, 06:37 AM
Tuxie Tuxie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Inside the GNU/Hurd kernel
Posts: 492 Tuxie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m
Reputation Power: 7
/home is meant for user folders,don't use it for C++ programs.
Further I have no clue why it doesn't work,can you show us the code?

Reply With Quote
  #3  
Old December 19th, 2002, 06:52 AM
damonbrinkley damonbrinkley is offline
Modz
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: NC, USA
Posts: 364 damonbrinkley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 18 sec
Reputation Power: 6
Send a message via AIM to damonbrinkley
Quote:
Originally posted by Tuxie
/home is meant for user folders,don't use it for C++ programs.
Further I have no clue why it doesn't work,can you show us the code?


Huh?

You can use your home folder to run whatever the heck you want. Especially if you're coding and testing some programs.

Try using gcc -o helloworld helloworld.c instead of g++.

Are you coding c++ or c?

Also, just because your distro didn't come with apache and php doesn't mean you can't get it. Go to their websites and download either a package or the source and you'll be good to go from there.

Reply With Quote
  #4  
Old December 19th, 2002, 07:33 AM
Tuxie Tuxie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Inside the GNU/Hurd kernel
Posts: 492 Tuxie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m
Reputation Power: 7
Quote:
Originally posted by damonbrinkley
Huh?You can use your home folder to run whatever the heck you want. Especially if you're coding and testing some programs.


No one said that you can't,but it's better to put that somewhere else,because it looks like there is a user named c++ then.

Reply With Quote
  #5  
Old December 19th, 2002, 03:44 PM
Marky_Mark Marky_Mark is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: On a screen near you
Posts: 498 Marky_Mark User rank is Private First Class (20 - 50 Reputation Level)Marky_Mark User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
The helloworld code is fine cause it compiles ok using g++ -c helloworld.c -o helloworld


And i agree with damonbrinkley you should be able to compile under /home but not sure if you can run binaries under /home


Just configured my modem under Linux so i will be downloading Apache and PHP


I would like to know if i can run binaries from /home/c++
I think it might be file permissions causing the errors

Reply With Quote
  #6  
Old December 19th, 2002, 03:55 PM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,829 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 5 m 8 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
It should not be a file permissions problem. I have a temp directory in my own home directory that I compile C and C++ programs with quite often for testing.
As long as you have permissions to execute in that directory, and the file is set as an executable then that should not matter.

On a side note, if you are coding in C, use gcc. No point in using a C++ compiler to compile a C program. (little bit of overkill and still going to be slow)

Reply With Quote
  #7  
Old December 19th, 2002, 08:42 PM
Marky_Mark Marky_Mark is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: On a screen near you
Posts: 498 Marky_Mark User rank is Private First Class (20 - 50 Reputation Level)Marky_Mark User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Good point about gcc and g++ however i still cant execute the binary

chmod 777 hello

bash: ./hello "cannot execute binary file"

I dont know why

Last edited by Marky_Mark : December 20th, 2002 at 12:29 AM.

Reply With Quote
  #8  
Old December 20th, 2002, 12:10 AM
kicken's Avatar
kicken kicken is offline
Wiser? Not exactly.
Dev Shed Specialist (4000 - 4499 posts)
 
Join Date: May 2001
Location: Ft Myers, FL
Posts: 4,074 kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)kicken User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)  Folding Points: 115670 Folding Title: Super Ultimate Folder - Level 1Folding Points: 115670 Folding Title: Super Ultimate Folder - Level 1Folding Points: 115670 Folding Title: Super Ultimate Folder - Level 1Folding Points: 115670 Folding Title: Super Ultimate Folder - Level 1Folding Points: 115670 Folding Title: Super Ultimate Folder - Level 1Folding Points: 115670 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 2 Weeks 5 Days 16 h 11 m 48 sec
Reputation Power: 463
Send a message via ICQ to kicken Send a message via AIM to kicken Send a message via MSN to kicken
Quote:
Originally posted by Marky_Mark
The helloworld code is fine cause it compiles ok using g++ -c helloworld.c -o helloworld


May be a typo, but thought I'd check, if you do g++ -c, then that only complies it, and doesn't link the program. You need to link it before it will run. Take the -c out and it should work.

Reply With Quote
  #9  
Old December 20th, 2002, 12:25 AM
Marky_Mark Marky_Mark is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: On a screen near you
Posts: 498 Marky_Mark User rank is Private First Class (20 - 50 Reputation Level)Marky_Mark User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
I thought the compile option done the linking aswell like in cygwin
Its ok now my helloworld runs fine, in future i will just emit the -c option


Thanks

Last edited by Marky_Mark : December 20th, 2002 at 12:27 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > Linux problems


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway