JAL Computing

C++COMProgramming .NET Mac Palm CPP/CLI Hobbies

 

Home
Up

X11 Xt FAQs under Panther

Q. Why do I get the error "unknown symbols _XOpenDisplay"?

A. You created the binary executable in "Development Mode" which, by default, has "Zero Link" enabled. With Zero Link enabled, the executable is not statically linked against the libX11.a library. To disable Zero Link, click on the Project Icon and then <Apple>I to open the Info box. Select Styles --> Zero Link --> deactivate Zero Link. Alternatively switch to a deployment build. Now add a reference to libX11.a

Q. How do I link dynamically against the X11 library?

A. Select the project in the IDE and do "GetInfo"--> Styles --> Common Settings --> Other Linker Flags and enter -L/usr/X11r6/lib/ -lX11. You may need to add the header search path /usr/X11r6/include/X11/

Q. Where is the libX11.a library? 

A. Open a terminal window and navigate to local/usr/x11r6/lib like this:
> cd /usr/x11r6/lib
> ls libX11.a

Q. Why can't I copy the libX11.a to my user folder using the Finder?

A. By default, the Finder hides system files. You can make the system files visible by editing the com.apple.finder.plist using the Property List Editor and setting AppleShowAllFiles to true. You can also move the file using the terminal by navigating to /usr/x11r6/ and doing:
> cp libx11.a ~/
You may need repair the archive index by doing:
> cd ~/
> ranlib libx11.a

Q. Why do I get a "bus error" when I run the executable from a terminal window?

A. You need to run the program from XTerm in the X Window environment. You can launch an X11 application from a terminal window as:
> /usr/bin/open-x11 myx11app

Q. Where are the custom applications in Panther?

A. The X11 applications reside at /usr/x11r6/bin. FINK may install the X11 applications at /sw/bin.

Q. I can connect over SSH, but why does the window open on the host?

A. You need to enable X11 forwarding on both the host and local machine.

Open Motif Xm FAQs

Q. Can I program with Open Motif?

A. Panther's X11 environment includes the Xt intrinsics library which allows you to use the Open Motif widget set. You can download the Open Motif package using FINK. The Open Motif libraries and headers are placed in /sw/lib and /sw/include respectively by FINK. I moved the headers in the Xm folder to /usr/x11r6/include/x11/Xm and I move the libraries libXm* to /usr/x11r6/lib

Q. Why do I get a compile or link error when I program against Open Motif?

A. For some reason if you link against Xm and Xt, you don't need to link against X11 under Panther. If you move the Open Motif headers to /usr/X11r6/include/X11/Xm then add the header path by selecting the project in the IDE and do "GetInfo"--> Styles --> Common Settings --> Header Search Paths --> and enter /usr/X11r6/include/X11/ Then got to Custom Linker Flags and enter -L/usr/X11r6/lib/ -lXm -lXt. Of course you need to copy (sudo rcp) the OpenMotif libraries (libXm*) from sw/lib to /usr/x11r6/lib for this to work. That's it!

Q. How do I compile a TestWidget Open Motif program from the command line?

A. Try g++ main.cpp -o TestWidget -I./ -I/usr/x11r6/include/x11/ -L/usr/x11r6/lib/ -lXm -lXt The g++ command calls gcc and links against the stdc++ library.

Q. How do I set the default size of my Open Motif window?

A. Navigate to /etc/X11/app-defaults and create a text file with the same name as the title bar in your Open Motif program (see the call to XtVaAppInitialize). Enter a single line such as:
*geometry:200X30
and save the changes. When your application starts, it will use this value to set the initial application window size.

Q. How do I statically link against a library?

A. From the command line add -Bstatic and any libraries on the command line that follow should be statically linked.

Q. Where is the lib -lXm?

A. If you use the -lXm symbol, the compiler looks for a library named libXm.a.

Q. Why can't I statically link to Xm?

A. For some reason prebinding fails when I try to statically link to libXm.a so that the Open Motif libraries need to be on the client. If you figure out how to statically link to libXm.a, please let me know!

Qt X11 Programming

Q. Can I write programs that compile to native code on Macs, Unix and Windows?

A. Check out Trolltech's open source application framework, Qt. Qt supports "write once, compile many" and is open source for both Mac OS X X11 and native Aqua applications.

Q. I can't download qmake using FINK?

A. Make sure you selected all the qt3 packages: qt3, qt3-designer, qt3-doc, qt3-linguist, and qt3-shlibs.

Q. Where did everthing go?

A. When you launch a terminal window, do a setenv command. You will see:
QTDIR=/sw
PATH= /sw/bin ...
QMAKESPEC=/sw/share/qt3/mkspecs/darwin-g++

qmake is at /sw/bin. You can use the "designer" program to create dialogs. You can create a user specific .login file at ~/ that looks like this:
setenv QTDIR /sw
setenv PATH $QTDIR/bin: $PATH
setenv LD_LIBRARY_PATH $QTDIR/lib

X11 On Win32 with Cygwin

Q. I installed Cygwin on Win32, downloaded openssh and the base XFree86 for remote X11. How do I connect to a remote X11 application under Cygwin?

A. From the Cygwin terminal just type:
>startxwin.sh
XTerm>ssh -X remoteUserName@remoteIPAddress nameOfRemoteApplication

Have fun.

 
Send mail to [email protected] with questions or comments about this web site. Copyright © 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 © 
Last modified: 08/04/09
Hosted by www.Geocities.ws

1