I added #define _WIN32_WINNT 0x0500 to the top of MyPrinter.h, like this:

#ifndef MYPRINTER_H
#define MYPRINTER_H
#define _WIN32_WINNT 0x0500
#include <windows.h>
class MyPrinter
...

Now it seems that it is a redifinition... and it still raises the same error. here is the output of the compilation:


C:\CodeBlocks\Myprojects\Win32App\MyPrinter.h|4|warning: "_WIN32_WINNT" redefined|
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.3.0\..\..\..\..\include\windef.h|20|warning: this is the location of the previous definition|
C:\CodeBlocks\Myprojects\Win32App\MyPrinter.cpp||In member function 'int MyPrinter::SetPaperType(short int)':|
C:\CodeBlocks\Myprojects\Win32App\MyPrinter.cpp|29|warning: unused variable 'hPrinter'|
C:\CodeBlocks\Myprojects\Win32App\MyPrinter.cpp|30|warning: unused variable 'dwNeeded'|
C:\CodeBlocks\Myprojects\Win32App\MyPrinter.cpp|31|warning: unused variable 'pi2'|
C:\CodeBlocks\Myprojects\Win32App\MyPrinter.cpp|32|warning: unused variable 'pDevMode'|
C:\CodeBlocks\Myprojects\Win32App\MyPrinter.cpp|33|warning: unused variable 'pd'|
C:\CodeBlocks\Myprojects\Win32App\MyPrinter.cpp|34|warning: unused variable 'bFlag'|
C:\CodeBlocks\Myprojects\Win32App\MyPrinter.cpp|35|warning: unused variable 'lFlag'|
C:\CodeBlocks\Myprojects\Win32App\MyPrinter.cpp|37|warning: unused variable 'pPrinterName'|
C:\CodeBlocks\Myprojects\Win32App\MyPrinter.cpp|43|warning: control reaches end of non-void function|
obj\Debug\MyPrinter.o:C:\CodeBlocks\Myprojects\Win32App\MyPrinter.cpp|40|undefined reference to `GetDefaultPrinterA@8'|
||=== Build finished: 1 errors, 11 warnings ===|

Please, if you have the project compilling whell, could you send me the project file to test in my machine?

Thanks a lot

JoseB


On Sat, Dec 18, 2010 at 8:28 PM, Keith Marshall <keithmarshall@users.sourceforge.net> wrote:
On Saturday 18 December 2010 18:36:07 Imóveis Nacionais wrote:
> I
> included the #include <winspool.h>  and a reference to the winspool
> library. When I compile it compiler says that it does not knows the
> GetDefaultPrinterA function,

How did you add the reference to the winspool library?
What was the error message?  A compile time error?  Or an unresolved
reference at link time?

You need to provide this sort of detail, or we can't help you.  You
should not expect anyone else to debug your project for you.  Reduce
it to a minimal test case.  See if you can build that, ideally from the
command line, without the distraction introduced by your choice of IDE.
That will often be sufficient to lead you to a solution on your own.

--
Regards,
Keith.

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
MinGW-users mailing list
MinGW-users@lists.sourceforge.net

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@lists.sourceforge.net?subject=unsubscribe