LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 06-02-2008, 08:16 PM   #1
prueba
LQ Newbie
 
Registered: Jun 2008
Posts: 2

Rep: Reputation: 0
Programming on Linux


Hi everyone,

I've just started using Linux 2 months back. Right now I need to write some C++ application for my school project, but my school machine is running on Windows and I don't have Windows XP installed at home...

After some reading up in the forum, I think MinGW is able to solve the problem. Correct me if I'm wrong. I'm currently using OpenSuSe 10.3 and using Netbean 6.1 as IDE and have installed MinGW as the cross-platform complier.

However there is one problem when testing out the simplest "Hello World" application with it. The errors are as follow:

/home/sk/netbeans-6.1/cnd2/bin/dorun.sh: line 103: ./dist/Debug/MinGW-Linux-x86/tutorial2: cannot execute binary file

Running "/usr/bin/make -f Makefile CONF=Debug" in /home/sk/NetBeansProjects/Tutorial2

/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/sk/NetBeansProjects/Tutorial2'
make[1]: Nothing to be done for `.build-conf'.
make[1]: Leaving directory `/home/sk/NetBeansProjects/Tutorial2'

Build successful. Exit value 0.

Running "/usr/bin/gnome-terminal --disable-factory --hide-menubar --title="dist/Debug/MinGW-Linux-x86/tutorial2 " -x "/home/sk/netbeans-6.1/cnd2/bin/dorun.sh" -p "[Press Enter to close window]" -f "/tmp/nbcnd_rc25797" dist/Debug/MinGW-Linux-x86/tutorial2 " in /home/sk/NetBeansProjects/Tutorial2

Run failed. Exit value 126.


I'm not too sure if it has anything to do with the MinGW complier or because the Linux kernel didn't support the file format, "cannot execute binary file" as shown. Please advices... Thanks in advance.
 
Old 06-02-2008, 09:10 PM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
It's netbeans a java thing? I am confused about what you are trying to build.
 
Old 06-03-2008, 09:22 AM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
If you just want to write code that uses standard input and output, then your code should be very portable between OS's. Don't bother with trying to run an IDE; just write your code with whatever source code editor you like on the host you are using. Compile and run on the local host. When you have things working, move the source to the target host, compile and run it there. You are making too much useless work for yourself.
If you need to write GUI oriented applications, you will have to use something like the Qt widgets to get any kind of cross-platform compatibility.
--- rod.
 
Old 06-03-2008, 12:10 PM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
yes, a simple, text mode C C++ program will work most anywhere.

write it with an editor, say first.c or first.cpp

(HINT: don't call it test as it's a unix function and you may cause some
confusion when you try to run!)

as long as you have installed the development libraries and such
you can simply do:

make first (not make first.c)

and it will make the whole lot for you.

and this should compile on your windows machine also.

and - congrats for having no windows!
stick it to your school using crap OS's.

p.s. if you find you must use Windows try this:
virtualbox

it really works.

Last edited by bigearsbilly; 06-03-2008 at 12:16 PM.
 
Old 06-04-2008, 04:36 AM   #5
prueba
LQ Newbie
 
Registered: Jun 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by matthewg42 View Post
It's netbeans a java thing? I am confused about what you are trying to build.
Ya, It's a Java IDE which allows development of C/C++.

Quote:
If you just want to write code that uses standard input and output, then your code should be very portable between OS's. Don't bother with trying to run an IDE; just write your code with whatever source code editor you like on the host you are using. Compile and run on the local host. When you have things working, move the source to the target host, compile and run it there. You are making too much useless work for yourself.
If you need to write GUI oriented applications, you will have to use something like the Qt widgets to get any kind of cross-platform compatibility.
--- rod.
Quote:
yes, a simple, text mode C C++ program will work most anywhere.

write it with an editor, say first.c or first.cpp

(HINT: don't call it test as it's a unix function and you may cause some
confusion when you try to run!)

as long as you have installed the development libraries and such
you can simply do:

make first (not make first.c)

and it will make the whole lot for you.

and this should compile on your windows machine also.

and - congrats for having no windows!
stick it to your school using crap OS's.

p.s. if you find you must use Windows try this:
virtualbox

it really works.
Thanks for the info guys,
I'm using an IDE because there will be quite some files for the project (it helps me with the files management) and I'm a beginner with C/C++.

My project source code requires "windows.h" which I obtained from MinGW C/C++ complier. The source was built successfully, but I couldn't run it. I guess it is due to the fact that "windows.h" is for widows and can only run on MS-DOS, and since I'm on Linux that uses shell, it couldn't execute as shown "cannot execute binary file" in the previous post. Not sure if it's right? Thanks.
 
  


Reply

Tags
c++, mingw



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
New Forum for Linux-Gurus[Programming/Administration] or Linux-Advanced Users [ Progr raees LQ Suggestions & Feedback 5 04-12-2005 07:35 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:58 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration