ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.