Baby mathlink question.
- To: mathgroup at smc.vnet.net
- Subject: [mg15319] Baby mathlink question.
- From: John L Weatherwax <wax at mit.edu>
- Date: Fri, 8 Jan 1999 04:15:09 -0500
- Organization: Massachusetts Institute of Technology
- Sender: owner-wri-mathgroup at wolfram.com
Hello,
I am new at this and am having trouble getting MathLink to work for the
first time. I am trying the example in the Mathematica book. I have
the following two files, sample2.tm and sample2.c
sample2.tm...
:Begin:
:Function: f
:Pattern: f[x_Integer, y_Integer]
:Arguments: {x, y}
:ArgumentTypes: {Integer, Integer}
:ReturnType: Integer
:End:
sample2.c...
#include "mathlink.h"
int f(int x, int y) {
return x+y;
}
int main(int argc, char *argv[]) {
return MLMain(argc, argv);
}
I am running on a unix platform and I type
mcc -o sample2
-I/usr/local/mathematica3.0/AddOns/MathLink/DevelopersKits/Solaris/CompilerAdditions
sample2.tm
and I get back...
Undefined first referenced
symbol in file socket
/usr/local/mathematica3.0/AddOns/MathLink/DevelopersKits/Solaris/CompilerAdditions/libML.a(sockport.o)
recv
/usr/local/mathematica3.0/AddOns/MathLink/DevelopersKits/Solaris/CompilerAdditions/libML.a(sockport.o)
f sample2.tm.o gethostbyname
/usr/local/mathematica3.0/AddOns/MathLink/DevelopersKits/Solaris/CompilerAdditions/libML.a(sockport.o)
accept
/usr/local/mathematica3.0/AddOns/MathLink/DevelopersKits/Solaris/CompilerAdditions/libML.a(sockport.o)
send
/usr/local/mathematica3.0/AddOns/MathLink/DevelopersKits/Solaris/CompilerAdditions/libML.a(sockport.o)
bind
/usr/local/mathematica3.0/AddOns/MathLink/DevelopersKits/Solaris/CompilerAdditions/libML.a(sockport.o)
setsockopt
/usr/local/mathematica3.0/AddOns/MathLink/DevelopersKits/Solaris/CompilerAdditions/libML.a(sockport.o)
gethostbyaddr
/usr/local/mathematica3.0/AddOns/MathLink/DevelopersKits/Solaris/CompilerAdditions/libML.a(sockport.o)
getsockname
/usr/local/mathematica3.0/AddOns/MathLink/DevelopersKits/Solaris/CompilerAdditions/libML.a(sockport.o)
main /opt/SUNWspro/SC4.0/lib/crt1.o
listen
/usr/local/mathematica3.0/AddOns/MathLink/DevelopersKits/Solaris/CompilerAdditions/libML.a(sockport.o)
connect
/usr/local/mathematica3.0/AddOns/MathLink/DevelopersKits/Solaris/CompilerAdditions/libML.a(sockport.o)
ld: fatal: Symbol referencing errors. No output written to sample2
I am sure that there is a one line answer to why this is not working. I
would greatly appreciate any help, anyone with more experience (or
brains) than myself could give.
Thanks, and sorry for my ignorance,
John Weatherwax