Hi

I have made a program that will change the settings of printer orientation.

But I am getting linker error.

" [Linker error] undefined reference to `OpenPrinterA@12' "

I am not able to find out the reason.

Kindly advice
Regards
Karan Gupta

Recommended Answers

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 …

Jump to Post

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.

Jump to Post

All 5 Replies

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.

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.

Hi

I am using DEV C++. Do I still need to link to libwinspool.a. If yes then what is the procedure to do that

Regards
Karan

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.

For specific compiler instructions its best to ask the people who wrote the compiler. Click here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.