[Linker error] undefined reference to `EnumPrintersA@28'

This is a discussion on [Linker error] undefined reference to `EnumPrintersA@28' within the C++ Programming forums, part of the General Programming Boards category; Hey all, i am new to c++ but there is something that eludes me. i am using Dev-C++ 4.9.9.2 and ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    7

    Smile [Linker error] undefined reference to `EnumPrintersA@28'

    Hey all,

    i am new to c++ but there is something that eludes me.

    i am using Dev-C++ 4.9.9.2 and my dll doesn't want to compile.

    for some odd reason i have an undefined reference to enumPrintersA

    Below is the code i use.
    Code:
    #include "Helloworld.h"
    #include <windows.h>
    #include <stdio.h>
    #include <Winspool.h>
    
    
    BOOL APIENTRY DllMain (HINSTANCE hInst     /* Library instance handle. */ ,
                           DWORD reason        /* Reason this function is being called. */ ,
                           LPVOID reserved     /* Not used. */ )
    {
        switch (reason)
        {
          case DLL_PROCESS_ATTACH:
            break;
    
          case DLL_PROCESS_DETACH:
            break;
    
          case DLL_THREAD_ATTACH:
            break;
    
          case DLL_THREAD_DETACH:
            break;
        }
    
        /* Returns TRUE on success, FALSE on failure */
        return TRUE;
    }
    
    JNIEXPORT void JNICALL Java_Helloworld_displayMessage
      (JNIEnv *, jobject)
      {
       
         DWORD dwNeeded, dwReturned; 
         PRINTER_INFO_4 * pinfo4;
         DWORD dwBytes = 0;
         DWORD dwStatus = 0;
         DWORD dwSize = 0;
         PRINTER_INFO_2* pPrnInfo2 =0;
         DEVMODE DevMode = {0};
         PRINTER_DEFAULTS PrnDef = {0, &DevMode, PRINTER_ACCESS_USE}; 
         EnumPrinters(PRINTER_ENUM_LOCAL, NULL, 4 , (PBYTE) pinfo4, dwNeeded, &dwNeeded, &dwReturned);
         printf(pinfo4->pPrinterName); 
      }
    thanks in advance for your replies

  2. #2
    ZuK
    ZuK is offline
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Quote Originally Posted by IKMOADBM
    i am using Dev-C++ 4.9.9.2 and my dll doesn't want to compile.
    Looks like your program compiles fine. What you have is a linker-error. You have to add the library that contains enumPrintersA to your project.
    Kurt

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    7
    thanks,

    i think i solved it now

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. C OpenGL Compiler Error?
    By Matt3000 in forum C Programming
    Replies: 12
    Last Post: 07-07-2006, 04:42 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 09:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21