#### Archived

This topic is now archived and is closed to further replies.

# Cross Platform Compiling Linux->Win32

This topic is 5272 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi everybody, I searched the net, I found a lot about Cross-Platform Compiling but nothing really answering my question. I am programming for Windows but I prefer to use Linux. Is it possible to write Win32 Programs containing Dialog Boxes, OpenGL and DirectX under Linux? Is it also possible to Debug and Test those Programs without booting Windows? I apreciate any help! Thanks. Nathan Hüsken

##### Share on other sites
I really dont know, but alot of those things you mentioned uses dll files which dont exist in linux.

##### Share on other sites
i don''t know for sure but see the wine library, i think it does what you want

##### Share on other sites
Iirc, WINE is about running Windows apps on Linux - not compiling Windows apps on Linux and running them on Windows.

It seems to me that what you want to do is to use a cross platform library like GTK, wxWindows, QT, SDL etc. to develop your application. Then once you get the code up and running on Linux, you then compile it on Windows. I can''t say for certain though as I''ve never done it myself.

Maybe someone else with more knowledge of the subject will drop in with a better answer...

##### Share on other sites
quote:
Iirc, WINE is about running Windows apps on Linux - not compiling Windows apps on Linux and running them on Windows.

you could always run a windows compiler using wine but there are compilers available to compile windows programs from linux. there was a thread about this a week or two ago which may be useful but i cba to find it.

##### Share on other sites
XMingwin should do what you are asking, will compile to windows dlls under linux, or libs for linux platform.

##### Share on other sites
Try Borland''s Kylix. It supports both C(++) and the Delphi language, and it can transparently handle the differences between Windows and Linux. The Open Edition is free for download and use from www.borland.com/kylix , although programs created with the OE must be published under (L)GPL.

##### Share on other sites
quote:
Original post by Mr Cucumber
I really dont know, but alot of those things you mentioned uses dll files which dont exist in linux.

There''s .so files which is the same idea. Doesn''t matter though, you only compile the code on linux, it still runs on Windows which has the dll available.

I''d suggest wxWindows for xplatform GUI, but that doesn''t help with xcompiling.

Some varaint of mingw is how you do that (need a special build of gcc too).

##### Share on other sites
Don''t waste your time with linux. Let yourself free!! Go win32!!! lol

##### Share on other sites
quote:

Don''t waste your time with linux. Let yourself free!! Go win32!!! lol

M$supporter. You probably don''t even know what linux is... -If you see this image I may or may not be online My website #### Share this post ##### Link to post ##### Share on other sites quote: Original post by brassfish89 M$ supporter. You probably don''t even know what linux is...

Linux zealot. You probably don''t even know what productivity is...

James Simmons
MindEngine Development
http://medev.sourceforge.net

##### Share on other sites
in general, you cannot use Win32 API calls in a linux program ... so the 2 choices are: use a crossplatform toolkit instead of Win32 API, or use an emulation layer to run under linux (WINE or vx???) ...

you also cannot use DirectX in linux programs, period .. so the only options here are to avoid it, or write a windows program which uses it, and run this program under linux using WineX ... which is how most games are run under linux (they are windows programs, running on a linux platform via WineX).

OpenGL is actually not a windows specific API, it is well supported under nearly all unix OSes ... so in this case, you simply compile programs for each platform which link to the correct library ... the API is identical on all platforms ... and in fact, Windows only has version 1.1 libraries, so you must use more extensions under windows than under linux/freebsd/*nix ...

I would highly recomend thinking about using the SDL and OpenGL for low level features ... or perhaps QT and OpenGL ... which includes a higher level widget set ... if you don''t use QT, you will want something like GTK+ to provide a widget set (combo boxes, etc) ...

IF that doesn''t suit your needs ... just write for 1 platform or the other ... it is easier to design and write for one platform, and then to learn the crossplatform stuff and change after the fact, than to have the double burden of learning the APIs and writing a complicated program at the same time ...

ALSO ... there is MONO to allow .Net programs to run under linux ... if you want to use C# and .Net ... then use MONO under linux ... stick to only the things which work under MONO and they will also work under windows.

##### Share on other sites
Um..

He only asked how to compile Windows code on Linux as he would rather use linux when coding. He never mentioned running any of those programs under linux .

##### Share on other sites
He didn''t want to boot Windows though, whichs means running the Win32 program on Linux, unless you have another idea?

Wine and/or WineX, or VMWare are the options for that.

##### Share on other sites
quote:
Original post by neurokaotix
quote:
Original post by brassfish89
M$supporter. You probably don''t even know what linux is... Linux zealot. You probably don''t even know what productivity is... Flaming for the helluvit linux zealot basher. You probably don''t even know you can save$100 per computer by using a more stable and easily customized operating system with better security than windows, thus saving your company from the latest virus, and also reducing nearby environmentalist protests about the monkeys you needed to have chained to computers clicking refresh on the windows patch site.

There are ways to compile windows programs from linux. It is quite easy, however, to use a cross-platform library, allowing you to debug/test/program under linux, and then compile for release under windows:

http://www.libsdl.org/

is the aforementioned SDL library. It is a cross-platform library that allows direct framebuffer access (for 2d things) or OpenGL (for 3d things) with hardware acceleration for both Linux (using DRI) and Windows (using API calls). There are allready GUI toolkits built atop this library available for download. And yes, it can do windows as well. I hear Mac OS X support is under development...

##### Share on other sites
quote:
Flaming for the helluvit linux zealot basher. You probably don''t even know you can save \$100 per computer by using a more stable and easily customized operating system with better security than windows, thus saving your company from the latest virus, and also reducing nearby environmentalist protests about the monkeys you needed to have chained to computers clicking refresh on the windows patch site.

Yes, I am very much a Linux zealot basher. What''s your point? Being a zealot isn''t a good thing. They love to shove their *very* narrow minded views whenever they get the opportunity (whenever someone mentions Windows or Microsoft).

By the way, last time I checked it wasn''t Windows that had more exploits out. Windows is just used everywhere that''s why it gets hit harder. Perhaps you''re suggesting a ''security through obscurity'' tactic by using Linux? Why are you attempting to make fun of the windows update site? I don''t recall anything so convienient for Linux users...

Oh well though, what do I know... I only like playing all the newest games, and having the best support for ohhh... everything.

James Simmons
MindEngine Development
http://medev.sourceforge.net

##### Share on other sites
quote:
Windows is just used everywhere that''s why it gets hit harder.

That''s a big comfort to the company that gets hit. "Hey, the reason your network is constantly down is because Windows is such a popular target among hackers, relax!"...

Qt

gl hf

##### Share on other sites
quote:
Original post by neurokaotix
By the way, last time I checked it wasn''t Windows that had more exploits out ... Perhaps you''re suggesting a ''security through obscurity'' tactic by using Linux?

I agree there are more security advisories posted concerning linux, this is an example of "security through openness". A typical linux security concern goes like this:

Some network coder discoveries a potential exploit whilst going through the inetd source. Posts details of exploit to linuxsecurity.com with accompanying fix. Major distributions provide updated packages the following day. Potential exploit is fixed and there are no reports of it becoming an actual exploit.

Compare that to a typical Windows security report, which usually involves an IIS worm making headlines as it spreads across the net. Windows and Linux probably start out with the same number of bugs and exploits, the fact that there are more reported concerning linux indicates that more of them are fixed.

quote:

Why are you attempting to make fun of the windows update site? I don''t recall anything so convienient for Linux users...

I type "apt-get upgrade" which downloads any updated packages, including those released with security fixes, automatically. On some machines I have it set up to run automatically. It''s neat.

##### Share on other sites
Back on topic: Depending on your needs you could use one of the above mentioned cross-platform libraries and compile / test everything on linux. Every now and then, you can recompile your program on a windows machine (if you have access to one) and see if everything works. (I''m writing a simple game with SDL on linux and today I tried to compile it on win2k: not a single warning / error. Works as a charm)
Normally, no problems should arise. I guess that would be faster and easier than digging into cross compiling stuff.