ADC Home > Reference Library > Technical Q&As > Carbon > Graphics & Imaging >

Not Recommended Documentclose button

Important: The information in this document is Not Recommended and should not be used for new development.

Current information on this Reference Library topic can be found here:

Using qd and QDGlobals


Q: I have a sample program compiled with SC. When I try to link the sample program, I get the following linker error:


### Link: Error: Undefined entry, name: (Error 28) "qd"
  Referenced from: main in file: :Obj 68K:FIFDECO.c.o

"qd" is the QuickDraw global variable. If I declare the global, as in


QDGlobals qd;

the error goes away. This is confusing, because globals declared for PowerPC code should also be automatically declared for 68K files. In fact, this same code compiles and links correctly with Symantec C++ v7.0 IDE, as well as Metrowerks Codewarrior. Is there some new library I need to include to get the 68K global declared? Or has some subtle change been made to the header files?

A: Recently, there has been a change to the MPW libraries for the classic Macintosh runtime architecture. The MPW libraries now require that the QuickDraw global qd be defined in the global space of your code, the same as in the MPW libraries for the other Macintosh runtime architectures (namely, PowerPC and CFM-68K runtime architectures). If you are working in the MPW environment, a simple definition such as:


 QDGlobals qd;

is all that is necessary. If you are working in multiple environments (say, MPW, Metrowerks, and Symantec), use a preprocessor conditional such as:


#if GENERATINGCFM
	QDGlobals qd;	// Required for all CFM environments
#else
#ifndef SYMANTEC_C || SYMANTEC_CPLUS
#define __MPW_ONLY__
#endif
#if defined (__SC__) && defined(__MPW_ONLY__) 
	QDGlobals qd;	// Required for SC in MPW compilations
#endif
#undef __MPW_ONLY__
#endif

may be required. For more details on the use of QDGlobals and qd, see Technote 1016 - Where Has my qd gone? How Do I Use qd and QDGlobals Correctly?

[Feb 09 1996]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.