CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    May 2010
    Posts
    38

    How Solve error LNK2019?

    Dear my friend,
    I have one code as below:

    Code:
    #define WIN32_LEAN_AND_MEAN  // Exclude rarely-used stuff from Windows headers
    #include <windows.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <string>
    #include <time.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <wininet.h>
    
    
    using namespace std;
    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif
    
    static bool bAccValidated = false;
    
    
    //----
    #define MT4_EXPFUNC __declspec(dllexport)
    //+------------------------------------------------------------------+
    //|                                                                  |
    //+------------------------------------------------------------------+
    
    //+------------------------------------------------------------------+
    
    
    MT4_EXPFUNC char* __stdcall Get_Account_Number()
    {
        return("889789619");
    }
    
    // the callback function to find our WND
    BOOL CALLBACK EnumWindowsProc( HWND hwnd, LPARAM lParam )
    {
        DWORD pid = lParam;
        DWORD pOfWindow = 0;
        GetWindowThreadProcessId(hwnd, &pOfWindow);    
        // this window is our process window
        if ( pOfWindow == pid )
        {
            char text[MAX_PATH];    
            GetWindowText(hwnd,text,sizeof(text));
            char* A_N = Get_Account_Number();
            if ( strstr(text, A_N) != NULL )
            {
                bAccValidated = true;        
                return (FALSE);
            }
        }
        return (TRUE);
    }
    
    
    MT4_EXPFUNC bool __stdcall Account_Validation()
    {
        bAccValidated = false;
        DWORD pid = GetCurrentProcessId();
        EnumWindows( EnumWindowsProc, pid );
        
        time_t seconds = time (NULL);
    
        if (bAccValidated && seconds<1293861600)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
    
    
    MT4_EXPFUNC char* __stdcall Get_Signal(double S1, double S2, double S3, double S4, double S5, double S6, double S7, double S8, double S9, double S10, double S11, double S12, double S13, double S14, double S15, double S16, double S17, double S18, double S19, double S20, double S21, double S22, double S23, double S24, double S25, double S26, double S27, double S28, double S29, double S30, double S31, double S32, double S33, double S34, double S35, double S36, double S37, double S38, double S39, double S40, double S41, double S42, double S43, double S44, double S45)
    {
        if ( Account_Validation() )
        {
            if ((S39> 95))
            {
                return("Sell" );
            }
            if ((S39< 5))
            {
                return("Buy");
            }
        }
        return("Forbiden");    
    }


    When compile that I have not any error but when want make dll and build I have below errors:

    1>------ Build started: Project: ExpertSample, Configuration: Debug Win32 ------
    1>Linking...
    1> Creating library .\Debug/ExpertSample.lib and object .\Debug/ExpertSample.exp
    1>LINK : warning LNK4199: /DELAYLOAD:OleAcc.dll ignored; no imports found from OleAcc.dll
    1>ExpertSample.obj : error LNK2019: unresolved external symbol __imp__GetWindowTextA@12 referenced in function "int __stdcall EnumWindowsProc(struct HWND__ *,long)" (?EnumWindowsProc@@YGHPAUHWND__@@J@Z)
    1>ExpertSample.obj : error LNK2019: unresolved external symbol __imp__GetWindowThreadProcessId@8 referenced in function "int __stdcall EnumWindowsProc(struct HWND__ *,long)" (?EnumWindowsProc@@YGHPAUHWND__@@J@Z)
    1>ExpertSample.obj : error LNK2019: unresolved external symbol __imp__EnumWindows@8 referenced in function "bool __stdcall Account_Validation(void)" (?Account_Validation@@YG_NXZ)
    1>.\Debug/ExpertSample.dll : fatal error LNK1120: 3 unresolved externals
    1>Build log was saved at "file://c:\Users\Reza\Desktop\Unlimited\DLLSample\Debug\BuildLog.htm"
    1>ExpertSample - 4 error(s), 1 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


    I added Wininet.lib too, but I have these errors too.
    Can you help me for solve that.
    Thanks.
    Last edited by ovidiucucu; June 22nd, 2010 at 04:23 AM. Reason: [CODE] and [/CODE] tags added

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured