error LNK2019: unresolved external symbol __imp__InternetCloseHandle

This is a discussion on error LNK2019: unresolved external symbol __imp__InternetCloseHandle within the C++ Programming forums, part of the General Programming Boards category; this is the code: Code: #include "stdafx.h" #include <wininet.h> wchar_t *lpszAgent; wchar_t *server = L"aaaa.t35.com"; wchar_t *username = L"aaaaaaaa.t35.com"; wchar_t ...

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    3

    error LNK2019: unresolved external symbol __imp__InternetCloseHandle

    this is the code:


    Code:
    #include "stdafx.h"
    #include <wininet.h>
    
    wchar_t *lpszAgent;
    wchar_t *server = L"aaaa.t35.com";
    wchar_t *username = L"aaaaaaaa.t35.com";
    wchar_t *password = L"gaaaaa";
    wchar_t upFileName[] = L"test.txt";
    wchar_t dir[] = L"test";
    HINTERNET hInternet;
    HINTERNET ftp;
    
    void upload(void);
    
    
    
    int APIENTRY _tWinMain(HINSTANCE hInstance,
                         HINSTANCE hPrevInstance,
                         LPTSTR    lpCmdLine,
                        int       nCmdShow)
    {
    	upload();
    	return 1;
    }
    
    void upload()
    {
    	
    
        
    	hInternet = InternetOpen( NULL, 1, NULL , NULL,1);
    
    	ftp = InternetConnect(hInternet, server,21, username, password, 1,1,1);
    	FtpCreateDirectory( ftp, dir  );
    	FtpSetCurrentDirectory(ftp, dir);
    
    	FtpPutFile( ftp, upFileName,upFileName,2, NULL);
    	
    	InternetCloseHandle(ftp);
    	InternetCloseHandle( hInternet);
    
    	
    }
    but i get these error no matter i tried in many computer (which installs both Visual studio 98 and Visual studio 2005), i dont' know why? can't any one help me?



    Code:
    Error	7	error LNK2019: unresolved external symbol __imp__InternetCloseHandle@4 referenced in function "void __cdecl upload(void)" (?upload@@YAXXZ)	et.obj	
    
    Error	8	error LNK2019: unresolved external symbol __imp__FtpPutFileW@20 referenced in function "void __cdecl upload(void)" (?upload@@YAXXZ)	et.obj	
    
    Error	9	error LNK2019: unresolved external symbol __imp__FtpSetCurrentDirectoryW@8 referenced in function "void __cdecl upload(void)" (?upload@@YAXXZ)	et.obj	
    
    Error	10	error LNK2019: unresolved external symbol __imp__FtpCreateDirectoryW@8 referenced in function "void __cdecl upload(void)" (?upload@@YAXXZ)	et.obj	
    
    Error	11	error LNK2019: unresolved external symbol __imp__InternetConnectW@32 referenced in function "void __cdecl upload(void)" (?upload@@YAXXZ)	et.obj	
    
    Error	12	error LNK2019: unresolved external symbol __imp__InternetOpenW@20 referenced in function "void __cdecl upload(void)" (?upload@@YAXXZ)	et.obj	
    
    Error	13	fatal error LNK1120: 6 unresolved externals	D:\My Documents\Visual Studio 2005\Projects\et\Debug\et.exe	1
    Last edited by stupidmistakez; 06-16-2006 at 04:52 AM.

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    Are you linking with WININET.LIB?

  3. #3
    Registered User
    Join Date
    Jun 2006
    Posts
    3
    yup!

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,475
    Try registering the dll with regsvr32
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 02:07 AM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 01:28 PM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM
  5. debug to release modes
    By DavidP in forum Game Programming
    Replies: 5
    Last Post: 03-20-2003, 02:01 PM

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