Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

A note on MathLink: cygwin Makefile for building addtwo.exe

  • To: mathgroup at
  • Subject: [mg78395] A note on MathLink: cygwin Makefile for building addtwo.exe
  • From: "Rolf.Mertig at" <Rolf.Mertig at>
  • Date: Sat, 30 Jun 2007 06:06:42 -0400 (EDT)

Somehow I could not get the instructions for
"Building MathLink programs with Microsoft Visual Studio"
(i.e., steps 39. up to 66.) to work.
Did anybody do this successfully? With or without VS-service packs?

Instead I played with cygwin, and just a GNU "make" of the Makefile
below will nicely build addtwo.exe on Windows XP.
This works similar for C++ projects.


# Makefile for addtwo using cygwin
# Rolf Mertig, GluonVision GmbH,
# run from a Cygwin bash shell, or an xterm:   make
# Assumes installation of cygwin (
# the important linker flag ( in order to suppress the DOS window) is
# see:

# change this to your Mathematica 6 installation

RM = rm
BINARIES = addtwo.exe

# Set this value with the result of evaluating $SystemID

# since we use the -mno-cygwin option we can use mldev32 instead of cygwin
CADDSDIR = ${MLINKDIR}/${SYS}/CompilerAdditions/mldev32

INCDIR = ${CADDSDIR}/include

EXTRALIBS = -mwindows #  see also:
MLLIB = ML32i3m # Set this to ML64i3 if using a 64-bit system


all : addtwo

addtwo : addtwotm.o addtwo.o
        ${CC} -I${INCDIR} addtwotm.o addtwo.o -L${LIBDIR} -l${MLLIB}
${EXTRALIBS}  -o $@

.c.o :
        ${CC} -c -mno-cygwin -mwin32 -I${INCDIR} $<

addtwotm.c :
        ${MPREP} $? -o $@

clean :
        @ ${RM} -f addtwotm.c *.o  ${BINARIES}

  • Prev by Date: Re: any way to force symbolic computation?
  • Next by Date: Re: managing version 6 in a locked-down environment
  • Previous by thread: Graphics package in v6