Hi

I am writing a code in which I have to display the print dialog.

PRINTDLG pdlg;
memset( &pdlg, 0, sizeof( PRINTDLG ) );
pdlg.lStructSize = sizeof( PRINTDLG );
pdlg.Flags = PD_RETURNDEFAULT | PD_RETURNDC;
PrintDlg( &pdlg );

But I am getting an error message

"[Linker error] undefined reference to `PrintDlgA@4' "

When I debug the code I found that I am getting this error on this line

PrintDlg( &pdlg );

Am I missing something.

Kindly advice

Regards
Karan

I think the library you need is libcomdlg32.a.

Generally, when you get linker errors related to Windows API functions, lookup the function's documentation in MSDN, scroll down to the bottom of page where you can find the name of the required .lib (i.e. in this case: Import library Comdlg32.lib). That gives you enough information to map the Win .lib file to the Dev-Cpp's counterpart.

Hi

Linking problem is solved but Print Dialog is not shown

Regards
Karan

What's the return-value of PrintDlg()?

Be a part of the DaniWeb community

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