Partner sites: Aminet - Amiga downloadsIntuitionBase - Amiga guidesAmigaNN - Amiga newsAmiFund - Sponsor projects

[Y]UtilityBase
Your guide to Amiga development
Not logged in
  HomeProjectsForumArticlesResourcesLinksChatAbout 
Search
Login
Username:
Password:
Register now!
Forgot your password?
Aminet - Development
Draco-src.lha (dev/lang)
peg-v0.1.4.tar.gz (dev/c)
peg-0.1.4-src.tar.gz (dev/c)
batari_Basic.lha (dev/cross)
pixman-src_aros.lha (dev/lib)
pixman_i386-aros.lha (dev/lib)
cairo-1.5.8-src_aros.lha (dev/lib)
cairo-1.5.8_i386-aros.lha (dev/lib)
vbcc_PosixLib.lha (dev/c)
IFF-RGFX.zip (dev/misc)
More...
Newest users
Tinlau
Lullaby20 (Erika)
alfkil (Alfkil Wennermark)
lole (Olle)
jeanluc72

Pending:
ZebraZeem, Mad_Dog, hhjoker, voxel, JosDuchIt, MarcB, MarBo, Sollaris, sara, species
More...
Who's Online
Online members:

NovaCoder 31 min(s) ago
Trev$46 min(s) ago

11 guests are online.

You are an Anonymous user. You can register for free by clicking here.
News sites
Amiga-News.de
Amiga.org
AmigaDev.net
AmigaNN
Amigans.net
Amigaweb.net
AmigaWorld.net
AROS-Exec
MorphOS-News.de
MorphZone
polarBoing
Tutorials
Installing the latest OS4 SDK in Cubic IDE
Writing Installer scripts for AmiUpdate
Cross Compiling for OS4 or OS3 using MS Visual Studio 2005
Installing an AmigaOS 4 cross compiler
Size does matter: Optimizing with size in mind with GCC
More...
Sources
Install SObjs with Installer
How to make clean picture datatypes
Most of the old ClassACT examples converted to OS4
AmigaAnywhere Tutorial - Part 2 Source window1.c
AmigaAnywhere Tutorial - Part 2 Source window2.c
More...
Documentations
How to write portable code for Amiga (english)
Comment écrire du code portable pour Amiga (français)
Development How to with OS3.9 SDK
The PartyPack Hack
The Amiga PDA Programming Guidelines
More...
DreamHost

Support
UtilityBase

[Valid RSS]

UtilityBase needs your help!

Cross Compiling for OS4 or OS3 using MS Visual Studio 2005
by Arthur Moyer

If you ever wanted to use the Visual Studio IDE to write Amiga programs, that is what this document is about.

This document uses Visual Studio 2005 as it's baseline since it has a very nice IDE, especially with plug-ins like Visual Assist (I think you can use the same directions for VS 2008 but since I don't have that I can't guarantee it).

Getting started:

-Download/acquire Visual Studio 2005. You may already have this, or you can get Visual Studio 2005 Express which is free. Install it.

-Download cygwin from http://www.cygwin.com . It will just give you a setup.exe file. Install it, and make sure you select "make" to be installed for the setup (it's under the development heading). (I'm sure gcc experts out there will have a bunch of other recommendations, but I'm use to VS not gcc, so I'm unfamiliar with all the gcc tools).

-Download the Cross compiler(s) you want from http://cross.zerohero.se . I've tried both the OS4 and OS3.x and they both work, and they can co-exist side by side. (If you are like me and like to compile on the go on your laptop, testing things out under OS3 via WinUAE can be useful!) Grab all the i686-cygwin for the compiler you want (or both) and any supporting files (including the SDK if OS4). The documentation on the particular webpage describes what you want to do with them. Install the ones you want to use, using the paths created by Cygwin that look like Unix. (ie. most of the stuff wants to be uncompressed to /usr/local which in my case is D:/cygwin/usr/local)

Configuring:

-You'll need to put the bin for the compilers in the Windows path. To do that you go to Start->Settings->Control Panel->System. Click on the Advanced Tab and click on Environment Variables. Find the path variable. Tack on where you installed your compiler and cygwin's bin path. (Ie. for me it is D:\cygwin\bin;D:\cygwin\usr\local\amiga\bin ) This will allow VS to call your gcc compiler.

-Open up VS, make a new project. Use Visual C++->General->Makefile Project. It will bring up a "wizard" to set certain configurations. Click "next" to go to the debug configuration. Under "Build Command line" put "make -f makefile.mak 2>&1 | sed -e 's/\(\w\+\):\([0-9]\+\):/\1(\2):/'" (Remove the double quotes, but leave the single quotes). Put the same for the rebuild. Under Clean, put "make -f makefile.mak clean". (Keep in mind that it's specifying the makefile as makefile.mak, so change that if you want it a different name)

And you are all done! You can start importing your C/C++ files into the project (and your makefile!). If you don't have a make file yet, you'll have to make one, but there is plenty on the net about that (although, honestly, I wouldn't mind a tutorial about that myself). A sample REALLY basic one would be:

CC=ppc-amigaos-gcc {This can either be m68k-amigaos-gcc or ppc-amigaos-gcc depending if you are trying for OS3.X or OS4 respectively) 

CFLAGS= {compiler flags go here such as -ggdb} 

CPPFLAGS = {preprocessor stuff goes here such as -D __USE_INLINE__} 

objects = {your final object files, such as main.o. It assumes that if there is a main.o there is a main.c that compiles into it. This objects variable is here to make things easier} 

{EXE name}: ${objects} 

clean: 
{tab which won't show up on a webpage}rm -f ${objects} 
Here is a REAL example...take this as literal:
CC=ppc-amigaos-gcc 

CFLAGS= -ggdb 

CPPFLAGS = -D GOWSP 

objects= GLTest.o 

GLTest: ${objects} 

clean: 
 rm -f ${objects} 

(Please note there is a tab before the rm -f ${objects})

A couple things to keep in mind, the debugger won't work with your new program. You'll have to use an Amiga debugger such a gdb under OS4. I heard that it is possible to setup remote GDB to work with VS, but I haven't even attempted that yet. Another thing is that while VS keeps around preprocessor information, it ends up being only for itself, and won't change your compile at all. Everything that you change MUST be in your make file. I wish VS would export the preprocessor directives in an environment variable like it does everything else, but I couldn't find it. Otherwise, it could pass it to the make file! (Perhaps someone wiser than me knows the answer).

Have fun coding!

(I'd like to thank SG2 for his initial help in getting this working, and Hans for helping me publish the article!)


Rate this item
12345678910


Last poster Message


Posted: 2008-May-27 00:06:15 · Edited by: EDanaII
My compliments to Arthur. Using his guide I was able to set up M$ VS 2005 to compile to AROS. However, I'm not using Cygwin, as he is. Instead, I set it up using AmiDevCpp's make and gcc utilities. This saved me time and space as loading Cygwin would have required both. The only thing I did different was the directories in the PATH variable. Instead of '<<cygwin>>\bin;' and '<<cygwin>>\usr\local\amiga\bin' I used, for my machine '<<AmiDevCpp>>\bin;' and '<<AmiDevCpp>>\usr\local\amiga\bin;' respectively.

No offense to DevCpp, but V$ is, unfortunately, nicer.

My compliments, Arthur.

Now, if we could only get the visual designer to work. Yea, yea... I know. :)

Ed.

:: Your comment
Bold Style  Italic Style  Underlined Style  Image Link  Insert URL  Email Link  Quote  C/C++ Source  Disable *What`s that?


Before posting non-english message, check your browser`s encoding!
» Name » Password

UtilityBase is a site focused on development for Amiga systems,
spanning over all different Amiga clones, that be AmigaOS 3.x, 4.x, MorphOS, AROS or AmigaDE/Anywhere.
News syndication: RSS
Contact address: mail@utilitybase com