![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Good point. I'm officially an idiot. Screw that then - I'll just use different files. Thanks for the help though.
|
|
|
|
|
|
#12 | |
|
Programmer
|
Quote:
#ifdef _WIN32 #include <windows.h> #endif ... common practice in winsock/bsd socket portability. Kinda vague, but you get the idea.
__________________
<span style='font-size:14pt;line-height:100%'><span style='color:red'>"Political power grows out of the barrel of a gun" - Mao Tse-Tung</span></span> |
|
|
|
|
|
|
#13 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
That's what I was going for... thought you meant you couldn't do that. So what's the #define for Linux? Is there anything that I could use, or do I just use #else?
|
|
|
|
|
|
#14 |
|
Programming Guru
![]() |
#ifdef _WIN32 #include <windows.h> #endif #ifndef _WIN32 #include more stuff... #endif Hmm.. guess i was wrong.
__________________
|
|
|
|
|
|
#15 |
|
Programmer
|
_WIN32 for Windows, unix for *BSD/Linux/UNIX, and __OS2__ for OS/2? That's what I remember, though I can't find any references for it.
__________________
<span style='font-size:14pt;line-height:100%'><span style='color:red'>"Political power grows out of the barrel of a gun" - Mao Tse-Tung</span></span> |
|
|
|
|
|
#16 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
It works! It works! Well, it works on Windows anyway... haven't tested it on Linux yet, but as it's a simple #else command - nothing fancy - it should be fine. The Linux library hasn't been written yet anyway. Now I just need to find out how to work threads - anyone got any links?
|
|
|
|
|
|
#17 |
|
Newbie
Join Date: Nov 2004
Posts: 3
Rep Power: 0
![]() |
You have to compile your program separately for each platform, so you can just invent your own define and test it
e.g. compiling on Windows cl -DWIN32 fred.cpp compiling on Linux gcc -Dlinux fred.cpp etc. On Unix/Linux make usually uses a variable called CFLAGS or CPPFLAGS and CC when doing compiles so you can sometimes have a makefile that works on multiple platforms but still detects the OS - something like. $(CC) $(CFLAGS) fred.cpp I build my programs to run on everything from Windows CE and MS-DOS through to Windows and AIX, and find this technique works well. |
|
|
|
|
|
#18 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
That was the plan - I'll see if it works when the Linux sockets library is up and running, and I find someone who knows how to use Linux
![]() |
|
|
|
|
|
#19 |
|
Programmer
|
If you're trying to write portable software, just use the SFU software pack from Microsoft, since it does come equiped with the BSD socket library. It runs a UNIX subsystem natively and you wouldn't really have to learn how to use Linux, just learn some software(of which you're most-likely somehwat familiar with i.e. gcc, gdb...)
http://www.microsoft.com/windows/sfu/
__________________
<span style='font-size:14pt;line-height:100%'><span style='color:red'>"Political power grows out of the barrel of a gun" - Mao Tse-Tung</span></span> |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|