简体   繁体   中英

How can I compile XJig for Snow Leopard?

I'm trying to compile XJig ( http://sourceforge.net/projects/xjig/ ) for Snow Leopard and getting errors:

make
c++ -m32 -DUSE_MIT_SHM  -DJIG_DEFAULT=\"/usr/lib/games/xjig/tina.gif\" -c xjig.C -o                                                         
xjig.o
xjig.C:161: warning: deprecated conversion from string constant to ‘char*’
xjig.C: In function ‘int main(int, char**)’:
xjig.C:527: warning: deprecated conversion from string constant to ‘char*’
xjig.C:527: warning: deprecated conversion from string constant to ‘char*’
xjig.C:527: warning: deprecated conversion from string constant to ‘char*’
xjig.C:720: warning: format not a string literal and no format arguments
c++ -m32 -DUSE_MIT_SHM    -c -o objects.o objects.C
c++ -m32 -DUSE_MIT_SHM    -c -o stack.o stack.C
c++ -m32 -DUSE_MIT_SHM    -c -o imgbuff.o imgbuff.C
c++ -m32 -DUSE_MIT_SHM    -c -o puzzle.o puzzle.C
c++ -m32 -DUSE_MIT_SHM    -c -o real.o real.C
c++ -m32 -DUSE_MIT_SHM    -c -o vec2.o vec2.C
c++ -m32 -DUSE_MIT_SHM    -c -o vec2list.o vec2list.C
c++ -m32 -DUSE_MIT_SHM    -c -o mat2.o mat2.C
c++ -m32 -DUSE_MIT_SHM    -c -o color_mapper.o color_mapper.C
c++ -m32 -DUSE_MIT_SHM    -c -o base_image.o base_image.C
c++ -m32 -DUSE_MIT_SHM    -c -o gif_image.o gif_image.C
c++ -m32 -DUSE_MIT_SHM    -c -o ximage.o ximage.C
c++ -m32 -DUSE_MIT_SHM    -c -o ppm_image.o ppm_image.C
In file included from ppm_image.C:6:
/usr/local/include/ppmcmap.h:110: 
error: expected declaration before ‘}’ token
make: *** [ppm_image.o] Error 1

It is complaining about the extern 'C' includes at the top of header files but my understanding is that a c++ compilers should understand this.

Should I be making a project in Xcode and compiling it in there? I have very little knowledge in compiling C source code but would like to get this working.

Update

The source was updated to 2.5.4 and fixes the error but I'm now getting:

make
c++ -m32 -DUSE_MIT_SHM  -DJIG_DEFAULT=\"/usr/lib/games/xjig/tina.gif\" -c xjig.C -o xjig.o
c++ -m32 -DUSE_MIT_SHM    -c -o objects.o objects.C
c++ -m32 -DUSE_MIT_SHM    -c -o stack.o stack.C
c++ -m32 -DUSE_MIT_SHM    -c -o imgbuff.o imgbuff.C
c++ -m32 -DUSE_MIT_SHM    -c -o puzzle.o puzzle.C
c++ -m32 -DUSE_MIT_SHM    -c -o real.o real.C
c++ -m32 -DUSE_MIT_SHM    -c -o vec2.o vec2.C
c++ -m32 -DUSE_MIT_SHM    -c -o vec2list.o vec2list.C
c++ -m32 -DUSE_MIT_SHM    -c -o mat2.o mat2.C
c++ -m32 -DUSE_MIT_SHM    -c -o color_mapper.o color_mapper.C
c++ -m32 -DUSE_MIT_SHM    -c -o base_image.o base_image.C
c++ -m32 -DUSE_MIT_SHM    -c -o gif_image.o gif_image.C
c++ -m32 -DUSE_MIT_SHM    -c -o ximage.o ximage.C
c++ -m32 -DUSE_MIT_SHM    -c -o jpeg_image.o jpeg_image.C
rm -f xjig
c++ -m32 -o xjig xjig.o objects.o stack.o imgbuff.o puzzle.o                       real.o vec2.o vec2list.o mat2.o                       color_mapper.o base_image.o gif_image.o ximage.o                      jpeg_image.o -g -O2 -fno-strict-aliasing       -lXext -lX11 -ljpeg -lnetpbm -lm     
ld: library not found for -lXext

The 'somebody' who fixed it was me. I rushed a fixed after your first posting. Go and download again.(2.5.4-1) I missed a couple of references to the old ppm stuff, the errors only showed on a fresh build. It should compile ok now.

If you still have problems, contact me directly.

About the make file. The make file is created by imake on the initial build.

You can use the supplied make files with most versions of Linux , but you should use the imake file by doing: xmkmf, make depend, make.

Just a note about the Makefile.

You should not edit the Makefile.

Use imake (xmkmf)

Imake is a tool for configuring the X Window System and its components for different platforms. It came with your X11 installation. The command for imake is xmkmf.

When you run 'xmkmf', it looks for a file called 'Imakefile' in the current directory, and makes a 'Makefile'.

So, to create a makefile for your system, you edit the Imakefile, and then run xmkmf in the xjig source folder.

Then do ' make depend ', ' make ', ' sudo make install '.

Update to my last post.

I do not have a mac, so I borrowed a mac with tiger on it to test with.

After making a couple of changes to the Imakefile, I successfully compiled xjig and installed it, and it runs ok.

The latest version is now 2.5.4-2, and I have uploaded it to xjigmanager.com and sourceforge.net/projects/xjig/

The downside is that because xjigmanager runs in gambas, which cannot run on the mac, you have to use xjig in xterm.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM