Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] c++ compile prolem



Brett,

I had a look at freya. It seems that the package hasn't been
updated since 2000. 

I suspect that the problem is with the definition of mmap. 
BSD traditionally used caddr_t as the return type, but
POSIX uses void *. I guess that FreeBSD is now using the POSIX
behavior by default. You may be able to use some command line
defines to switch it into some compatibility mode. I am not sure
what that would be, though, as I don't have a FreeBSD install 
handy. Or you could try changing the type of mappaddr to 
void * in XMap.h. 

I tried to compile on my Linux box with GCC 3.2.2, and it 
failed on some funky C++ written in 1997. As the package
doesn't seem to be maintained, I would hesitate to use it.

Jake





--- Brett Robson <b-robson@example.com> wrote:
> 
> Sorry to ask such a basic question, but short of learning c++ 
> there's not much I can do.
> 
> I need to install some c++ programmes and I've hit a compile error.
> 
> ----------------------------------------------------
> XMap.cc: In method `XMap::XMap(int)':
> XMap.cc:32: ANSI C++ forbids implicit conversion from `void *' in 
> assignment
> *** Error code 1
> 
> Stop in /web/standard/www.pacifica.co.jp/temporary/freya-0.92.4/src.
> ----------------------------------------------------
> 
> Using:
> gcc version 2.95.3 20010315 (release) [FreeBSD]
> 
> This is code section below, the error line, line 32, is 
> higlighted with ***  I assume off_t is standard type, it's not 
> defined in the source anywhere. I've fiddled with compile options 
> to no avail.
> 
> Thanks,
> Brett
> 
> ----------------------------------------------------
> XMap::XMap(int filedesc)
>      : fd(filedesc)
> {
>      struct stat st;
>      fstat(fd, &st);
>      mapsize = st.st_size;
>      entryNum = mapsize / ENTRYSIZE - 1;
>      mapaddr = mmap(NULL,        // start address (hint)
>                     mapsize,     // size
>                     PROT_READ,   // protection
>                     MAP_SHARED,  // flags
>                     fd,          // file descriptor
> ***                (off_t)0 );         // file offset
>      if((caddr_t)(-1) == mapaddr)
>          PRINTERRMSG("mmap() failed.");
>      maxoffset = getbase(entryNum); // 
> \xbe\xef\xa4\xcb\xc5\xf9\xa4\xb7\xa4\xa4
> 
>      scores = new int[TYPENUM + 1];
>      short int *p = (short int *)((char *)mapaddr +
>                                   ENTRYSIZE * entryNum + 
> sizeof(pos_t));
>      scores[0] = 1;
>      for(int i = 0; i < TYPENUM; i++)
>          scores[i+1] = p[i];
> }
> ----------------------------------------------------
> 
> 
> **********************************************************
> TLUG server is hosted by Open Source Development Lab Japan
> http://www.osdl.jp/
> **********************************************************
> 
> ==========================================================
> To unsubscribe from this mailing list, 
> please see instructions at <http://www.tlug.jp/list.html>
> ==========================================================
> 


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links