Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
I have to develop a small .exe file that will run directly after download without any installation on windows and linux. and size of the exe should be less than 1mb. Which is the best dev. tool/language to use.
Posted

If you agree to use .NET and C++/CLI instead of plain C++ you can create .NET software which will run on another OS (and of course on Linux) under Mono without re-compilation.

See:
http://en.wikipedia.org/wiki/Mono_(software)[^],
http://www.mono-project.com/[^].

You will need to use the standard subset of .NET library plus number of non-standard assemblies like System.Windows.Forms to be compatible with Mono. You can also install Mono on Windows and run it under Mono on Windows or use it for development. I develop my windowed UI with Forms and run it on Linix without re-compilation. This is the only opportunity supported by C++ I know. (Another popular way is Java, but you're asking only about C++, right?)

There is a number of other platforms to write UI using C++ which can be run on Windows and Linux, but they all will need separate build for each system. It includes GTK++, Qt and more.

Good luck,
—SA
 
Share this answer
 
v2
Comments
Albert Holguin 1-May-11 1:38am    
good answer.. my 5
Sergey Alexandrovich Kryukov 1-May-11 1:43am    
Thank you, Albert.
--SA
If you say, you want to use native C++, then it's not possible.
You must build it separately for Windows and Linux, using appropriate compiler, and linker.
Even on Windows when you need to give both 32-bit and 64-bit executables, you need to have two separate builds for them.
 
Share this answer
 
Am I the only person here that has noticed the glaring ommission of a wine prohibition?
People do it all the time, you don't need to resort to .NET or to recompilation.

All of the linux distros I get come with both gcc and wine. A can assure you that wine gets far more of a workout than (linux's)gcc does around these parts.

Sure wine isn't bomb-proof, nor is it a part of every distro - though neither of these were mentioned as being restrictions.

Given the tone of the question suggests homework to me, and that there is no mention of restrictions/requirements that prevent the use of wine - I'd just compile it on a windoze box and run it on either.

If it's good enough for MS Office to run in linux without installation (must make thinstall version of program first - self-contained usb-portable version) under wine, then it's plenty good enough for your project, methinks.
 
Share this answer
 
Comments
Hans Dietrich 2-May-11 2:09am    
I have seen a lot of blogs about MS Office and wine. For some people, it works; for others, it consistently crashes.

If you know of a good beginners tut for wine, maybe you can post the link here, so the OP can try it for himself?
enhzflep 2-May-11 2:34am    
Aw shucks, you've caught me out! I haven't actually used linux for more than about 5 mins over the course of the last 2 years, funnily enough because the timetable scheduling software I used at work resolutely refused to work for me under wine.
I haven't tried a new distro for quite some time, so I'd assume the landscape to be more forgiving, though with more complex applications being developed I'd understand if it was a losing battle ensuring that wine kept-up.
For what it's worth - I had success running Office 2003, though always had problems with Office 2007. Though I could never quite manage to install either (some incompatibility with the installer, I guess - perhaps it needed the Windows Installer update installed?) This inability to actually install while running under wine was what prompted me to try a Thinstall version (now known as VMWare ThinApp).

Happy coding. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900