Thread Subject: Compiling pnet with mex

Subject: Compiling pnet with mex

From: Peter

Date: 13 May, 2008 19:31:03

Message: 1 of 3

I am trying to build the pnet package (tcp_dup_ip) using
mex. I'm running 64bit linux and hence the supplied
pnet.mexglx does not work.

I have gcc 4.2.0 installed. When I run mex on pnet.c I get
alot of errors (see below). If I compile with the "CC=G++"
option, less errors, but still alot. I suspect I'm doing
something wrong since no one else has mentioned trouble
compiling this package that I can find.

Thanks.
------------------------------------------------------


> mex -O pnet.c
pnet.c: In function ‘newbuffsize’:
pnet.c:225: error: expected expression before ‘/’ token
pnet.c:235: error: expected expression before ‘/’ token
pnet.c:239: error: expected expression before ‘/’ token
pnet.c: In function ‘str2classid’:
pnet.c:258: error: expected expression before ‘/’ token
pnet.c: In function ‘byteswapdata’:
pnet.c:323: error: expected expression before ‘/’ token
pnet.c:329: error: ‘ordertest’ undeclared (first use in this
function)
pnet.c:329: error: (Each undeclared identifier is reported
only once
pnet.c:329: error: for each function it appears in.)
pnet.c:330: error: expected expression before ‘/’ token
pnet.c:336: error: expected expression before ‘/’ token
pnet.c: In function ‘byteswapcopy’:
pnet.c:360: error: expected expression before ‘/’ token
pnet.c:363: error: ‘ordertest’ undeclared (first use in this
function)
pnet.c:366: error: expected expression before ‘/’ token
pnet.c:369: error: expected expression before ‘/’ token
pnet.c:375: error: expected expression before ‘/’ token
pnet.c:378: error: expected expression before ‘/’ token
pnet.c: In function ‘my_now’:
pnet.c:418: error: expected expression before ‘/’ token
pnet.c:419: error: expected expression before ‘/’ token
pnet.c:421: error: expected expression before ‘/’ token
pnet.c:423: error: expected expression before ‘/’ token
pnet.c: In function ‘move_con’:
pnet.c:444: error: expected expression before ‘/’ token
pnet.c:449: error: expected expression before ‘/’ token
pnet.c: In function ‘my_mexIsInputArgOK’:
pnet.c:464: error: expected expression before ‘/’ token
pnet.c:464: error: expected expression before ‘/’ token
pnet.c: In function ‘my_mexInputArg’:
pnet.c:474: error: expected expression before ‘/’ token
pnet.c:474: error: expected expression before ‘/’ token
pnet.c: In function ‘my_mexReturnValue’:
pnet.c:610: error: expected expression before ‘/’ token
pnet.c:610: error: expected expression before ‘/’ token
pnet.c: In function ‘my_mexReturnArrayFromBuff’:
pnet.c:659: error: expected expression before ‘/’ token
pnet.c:667: error: expected expression before ‘/’ token
pnet.c:668: error: expected expression before ‘/’ token
pnet.c:670: error: expected expression before ‘/’ token
pnet.c:673: error: expected expression before ‘else’
pnet.c:677: error: expected expression before ‘/’ token
pnet.c:683: error: expected expression before ‘/’ token
pnet.c:709: error: expected expression before ‘/’ token
pnet.c:710: error: expected expression before ‘/’ token
pnet.c:716: error: expected expression before ‘/’ token
pnet.c: In function ‘ipv4_lookup’:
pnet.c:733: error: expected expression before ‘/’ token
pnet.c: In function ‘writedata’:
pnet.c:760: error: expected expression before ‘/’ token
pnet.c:762: error: expected expression before ‘/’ token
pnet.c:780: error: expected expression before ‘/’ token
pnet.c:783: error: expected expression before ‘/’ token
pnet.c: In function ‘read2buff’:
pnet.c:854: error: expected expression before ‘/’ token
pnet.c:866: error: expected expression before ‘/’ token
pnet.c:868: error: expected expression before ‘/’ token
pnet.c:874: error: expected expression before ‘/’ token
pnet.c:874:11: error: too many decimal points in number
pnet.c:887: error: expected expression before ‘/’ token
pnet.c:890: error: expected expression before ‘/’ token
pnet.c:893: error: expected expression before ‘/’ token
pnet.c:898: error: expected expression before ‘/’ token
pnet.c: At top level:
pnet.c:919: error: expected identifier or ‘(’ before ‘/’ token
pnet.c: In function ‘mexFunction’:
pnet.c:1054: error: expected expression before ‘/’ token
pnet.c:1067: error: expected expression before ‘/’ token
pnet.c:1067: error: expected expression before ‘/’ token
pnet.c:1107: error: expected expression before ‘/’ token
pnet.c:1111: error: expected expression before ‘/’ token
pnet.c:1111: error: expected expression before ‘/’ token
pnet.c:1141: error: expected expression before ‘/’ token
pnet.c:1154: error: expected expression before ‘/’ token
pnet.c:1158: error: expected expression before ‘/’ token
pnet.c:1174: error: expected expression before ‘/’ token
pnet.c:1256: warning: cast from pointer to integer of
different size
pnet.c:1260: warning: cast from pointer to integer of
different size

    mex: compile of 'pnet.c' failed.

Subject: Compiling pnet with mex

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 13 May, 2008 20:09:49

Message: 2 of 3

In article <g0cq9n$k2k$1@fred.mathworks.com>, Peter <pneilley@wsi.com> wrote:
>I am trying to build the pnet package (tcp_dup_ip) using
>mex. I'm running 64bit linux and hence the supplied
>pnet.mexglx does not work.

>I have gcc 4.2.0 installed. When I run mex on pnet.c I get
>alot of errors (see below). If I compile with the "CC=G++"
>option, less errors, but still alot. I suspect I'm doing
>something wrong since no one else has mentioned trouble
>compiling this package that I can find.

>> mex -O pnet.c
>pnet.c: In function ‘newbuffsize’:
>pnet.c:225: error: expected expression before ‘/’ token

When you get lots of complaints about expecting an expression
before a / token, then the problem is almost certainly that you
have used a C89 compliant compiler to attempt to compile code
that uses // style comments. // style comments were not made an
official part of C until C99, but they are a common extension.
gcc will normally allow them even in C89 mode unless options
have been passed to gcc telling it to be very strict.

C++ has included // style comments for much longer, so when you
compile with G++ the problems with those comments go away.
--
  "Not the fruit of experience, but experience itself, is the end."
                                              -- Walter Pater

Subject: Compiling pnet with mex

From: Peter

Date: 14 May, 2008 00:53:02

Message: 3 of 3

Thanks Walter, That did the trick. Although I couldn't
figure out how to get the mex compiler to run gcc4 allowing
the extended comment syntax "//", I just edited the source
code to change all comments to standard C comment syntax
("/*... */"). That did the trick. All the other errors
reported by the compiler (that at first glance seemed
unrelated to the comment issue) were resolved.

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <g0csid$7kg$1@canopus.cc.umanitoba.ca>...
> In article <g0cq9n$k2k$1@fred.mathworks.com>, Peter
<pneilley@wsi.com> wrote:
> >I am trying to build the pnet package (tcp_dup_ip) using
> >mex. I'm running 64bit linux and hence the supplied
> >pnet.mexglx does not work.
>
> >I have gcc 4.2.0 installed. When I run mex on pnet.c I get
> >alot of errors (see below). If I compile with the "CC=G++"
> >option, less errors, but still alot. I suspect I'm doing
> >something wrong since no one else has mentioned trouble
> >compiling this package that I can find.
>
> >> mex -O pnet.c
> >pnet.c: In function ‘newbuffsize’:
> >pnet.c:225: error: expected expression before ‘/’ token
>
> When you get lots of complaints about expecting an expression
> before a / token, then the problem is almost certainly
that you
> have used a C89 compliant compiler to attempt to compile code
> that uses // style comments. // style comments were not
made an
> official part of C until C99, but they are a common extension.
> gcc will normally allow them even in C89 mode unless options
> have been passed to gcc telling it to be very strict.
>
> C++ has included // style comments for much longer, so
when you
> compile with G++ the problems with those comments go away.
> --
> "Not the fruit of experience, but experience itself, is
the end."
> -- Walter Pater

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com