The reason is that you did not include the correct library. Look up that function in MSDN and it will tell you what library you need. Go to www.microsoft.com and enter OpenPrinter in its search box, it will give you a list of links. Select the first link in the list, when the page comes up, scroll down to the bottom and you will see the name of the library you need.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
But I am getting linker error.
" [Linker error] undefined reference to `OpenPrinterA@12' "
You (may) need to #include <winspool.h>
If you are not using a MS compiler, you need to link with libwinspool.a, otherwise winspool.lib.
mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395
I am using DEV C++. Do I still need to link to libwinspool.a.
Yes, to link with libwinspool.a, open the Project/Options/Parameters tab, click Add Library or Object and browse for that library.
mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395
For specific compiler instructions its best to ask the people who wrote the compiler. Click here
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343