Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SOLVED: "Hello World!" - So, what next...?

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
alloydog
LXF regular


Joined: Thu Apr 07, 2005 8:32 pm
Posts: 600

PostPosted: Wed Jun 21, 2006 5:03 am    Post subject: SOLVED: "Hello World!" - So, what next...? Reply with quote

For some reason KDevelop wouldn't compile the "Hello World!" script, so while I get around to fixing it, I installed Xwpe.

I wrote the obligatory "Hello world" script, and in Xwpe, it compiled OK and ran OK.

Now... the last time I tried learning C++, I used a give-away copy of Borland's C++ Builder/TurboC++ version 1 (hence the familiarity with Xwpe) under Windows 98 and NT.

When I complied the script, I got a nice executable file helloworld.exe.

Now I'm using this Linuxy thing, I get helloworld.o and helloworld.e.

I thought the Unix/Linux equivilent of the .exe was a .bin file?
What do I need to get Hello World to print out at the command line, as it would under DOS with the executable?

----edit------
Solved!

Code:
# helloworld.e
# Hello World!
#


simple really Embarassed
Back to top
View user's profile Send private message
penguintutor



Joined: Mon Jun 05, 2006 2:41 pm
Posts: 16
Location: UK

PostPosted: Wed Jun 21, 2006 4:12 pm    Post subject: Reply with quote

I am not familiar with Xwpe, which appears to have discontinued development, and is lacking in documentation. Here is some generic info that might help.

On unix the file extension is not used to determine whether something is executable or not. Instead the first few bytes of the file are examined to see if it is a program. So the extension doesn't matter. For some formats the normal conventions are used, but for executables normally they are created without any extension so that you just run using the name of the command (without needing to add .exe or .bin on the end).

The .o file is an object file, but I'm not sure about a .e file.
you can see if the operating system recognises the file using:
Code:

file helloworld.e

which may give an idea of what the file is.

Has the program been linked? Without documentation I don't know how that is done, maybe it works with the standard linker?

If it has actually created a binary executable, then you may just need to change it's permissions

Code:

chmod u+x [i]filename[/i]

_________________
--
PenguinTutor
Penguin Tutor Linux Tutorials and unofficial LPI Certification Practice Exams
twitter.com/PenguinTutor
Back to top
View user's profile Send private message Visit poster's website
alloydog
LXF regular


Joined: Thu Apr 07, 2005 8:32 pm
Posts: 600

PostPosted: Wed Jun 21, 2006 5:28 pm    Post subject: Reply with quote

just typing helloworld.e at the command line worked fine. The problem was between the chair and the keyboard...

I was expecting helloworld.bin, so was 'confused' a bit by the .e extention.

I didn't know about the file command though.
Code:
# file helloworld.e
helloworld.e: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0, dynamically linked (uses shared libs), not stripped

Interesting bit: 32-bit LSB executable, Intel 80386 - I thought the 386 was 16-bit?
Back to top
View user's profile Send private message
penguintutor



Joined: Mon Jun 05, 2006 2:41 pm
Posts: 16
Location: UK

PostPosted: Wed Jun 21, 2006 5:48 pm    Post subject: Reply with quote

The 80386 was a full 32 bit processor, which became known as the 80386DX when the SX was released.

The 80386SX was internally a 32 bit processor, but had only a 16bit external bus.
_________________
--
PenguinTutor
Penguin Tutor Linux Tutorials and unofficial LPI Certification Practice Exams
twitter.com/PenguinTutor
Back to top
View user's profile Send private message Visit poster's website
GMorgan
LXF regular


Joined: Thu Jan 12, 2006 6:58 pm
Posts: 684
Location: South Wales, UK

PostPosted: Wed Jun 21, 2006 7:47 pm    Post subject: Reply with quote

With Kdevelop what do you mean it didn't compile. Do you mean there was no compile option or that it did have a compile option but it didn't work. To get Kdevelop to work properly you need to create a project. Create a simple hello world C++ project and you can then compile via the three buttons above the text editor and at the leftmost corner.

If you are seriously having problems with it post the console output and we can try and fix it.
Back to top
View user's profile Send private message
alloydog
LXF regular


Joined: Thu Apr 07, 2005 8:32 pm
Posts: 600

PostPosted: Wed Jun 21, 2006 8:57 pm    Post subject: Reply with quote

Thanks, I'm checking that out now.
Back to top
View user's profile Send private message
alloydog
LXF regular


Joined: Thu Apr 07, 2005 8:32 pm
Posts: 600

PostPosted: Thu Jun 22, 2006 8:44 pm    Post subject: Reply with quote

Kdevelope works fine - once you start a new project...

well which methed should I use?

GEdit + command line compiling => walking
Xwpe => riding a bicycle
KDevelope => fully equipped motorhome, including the kitchen sink...

Smile
Back to top
View user's profile Send private message
GMorgan
LXF regular


Joined: Thu Jan 12, 2006 6:58 pm
Posts: 684
Location: South Wales, UK

PostPosted: Fri Jun 23, 2006 10:01 am    Post subject: Reply with quote

I like Kdevelop since it can be used for every language under the sun. If in future you decide to learn a scripting language like Python and combine it with C++ (i.e. C++ for the backend and Python for the GUI for quick interface turnover) it can be done using the same tool. Not to mention that its plugin architecture allows you to run things like QT Designer within the project and even import QT UI files directly into a C++ project.
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast