Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. why ? [modified]

why ? [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpvisual-studiocomsysadmin
13 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S stupidmistakez

    this is the 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? 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 -- modified at 7:16 Friday 16th June, 2006

    _ Offline
    _ Offline
    _AnsHUMAN_
    wrote on last edited by
    #2

    In the additional lib's have you specified Wininet.lib? You also need to include the file wininet.h in the file where you are using the API functions. Somethings seem HARD to do, until we know how to do them. ;-) _AnShUmAn_

    S 1 Reply Last reply
    0
    • _ _AnsHUMAN_

      In the additional lib's have you specified Wininet.lib? You also need to include the file wininet.h in the file where you are using the API functions. Somethings seem HARD to do, until we know how to do them. ;-) _AnShUmAn_

      S Offline
      S Offline
      stupidmistakez
      wrote on last edited by
      #3

      You also need to include the file wininet.h in the file where you are using the API functions. --> does it mean i have to include wininet.h in the "upload" funtion?

      K _ 2 Replies Last reply
      0
      • S stupidmistakez

        You also need to include the file wininet.h in the file where you are using the API functions. --> does it mean i have to include wininet.h in the "upload" funtion?

        K Offline
        K Offline
        kakan
        wrote on last edited by
        #4

        As it seems, that's not the problem. The errors you get are all link errors, so they originates from not linking wininet.lib

        S 1 Reply Last reply
        0
        • K kakan

          As it seems, that's not the problem. The errors you get are all link errors, so they originates from not linking wininet.lib

          S Offline
          S Offline
          stupidmistakez
          wrote on last edited by
          #5

          but i need detail solution? can you or anyone help me ? please!

          K G L V 4 Replies Last reply
          0
          • S stupidmistakez

            but i need detail solution? can you or anyone help me ? please!

            K Offline
            K Offline
            kakan
            wrote on last edited by
            #6

            If you got VC 6 (as me), do this: 1. Press AltF7 to get to "Project"->"Settings" 2. In the left window (top), select "All Configurations" 3. Click on the "Link" tab 4. Select "Category" Input 5. In the edit line under "Object/Library modules", go to the end of the line. 6. write a space, followed by wininet.lib 7. Click the "OK" button Build (or rebuild) the project.

            1 Reply Last reply
            0
            • S stupidmistakez

              but i need detail solution? can you or anyone help me ? please!

              G Offline
              G Offline
              Ganesh_T
              wrote on last edited by
              #7

              Have you Selected the proper project. Because after including the files Wininet.h and Wininet.lib the program runs perfectly well. And if you don't include it It will give the errors as you have described Cheers "Peace of mind through Technology"

              1 Reply Last reply
              0
              • S stupidmistakez

                but i need detail solution? can you or anyone help me ? please!

                L Offline
                L Offline
                Laxman Auti
                wrote on last edited by
                #8

                stupidmistakez wrote:

                but i need detail solution? can you or anyone help me ? please!

                Just add the following in your Stdafx.h header file #pragma comment(lib, "wininet"); Knock out 't' from can't, You can if you think you can :cool:

                K 1 Reply Last reply
                0
                • S stupidmistakez

                  You also need to include the file wininet.h in the file where you are using the API functions. --> does it mean i have to include wininet.h in the "upload" funtion?

                  _ Offline
                  _ Offline
                  _AnsHUMAN_
                  wrote on last edited by
                  #9

                  No you only need to include the wininet.h file where you are using the API functions at the top where you are including rest of the files Alternatively you can include this wininet.h file in the stdafx.h file if you are using this API at various places in your project Somethings seem HARD to do, until we know how to do them. ;-) _AnShUmAn_

                  1 Reply Last reply
                  0
                  • S stupidmistakez

                    but i need detail solution? can you or anyone help me ? please!

                    V Offline
                    V Offline
                    Viorel
                    wrote on last edited by
                    #10

                    Open the Properties dialog of your project and go to Linker --> Input --> Additional Dependencies fiels. Type here "Wininet.lib" (use space as separator, if there are other items). Repeat this for Debug and Release configurations. Then try to build the project. The libraries and headers you need usually are described in the documentation. Hope it helps.

                    1 Reply Last reply
                    0
                    • L Laxman Auti

                      stupidmistakez wrote:

                      but i need detail solution? can you or anyone help me ? please!

                      Just add the following in your Stdafx.h header file #pragma comment(lib, "wininet"); Knock out 't' from can't, You can if you think you can :cool:

                      K Offline
                      K Offline
                      kakan
                      wrote on last edited by
                      #11

                      :-O Of course. I'm using it all the time, and still I forgot when I wrote my answer :doh:

                      L 1 Reply Last reply
                      0
                      • K kakan

                        :-O Of course. I'm using it all the time, and still I forgot when I wrote my answer :doh:

                        L Offline
                        L Offline
                        Laxman Auti
                        wrote on last edited by
                        #12

                        kakan wrote:

                        Of course. I'm using it all the time, and still I forgot when I wrote my answer

                        Remember next time :) Knock out 't' from can't, You can if you think you can :cool:

                        K 1 Reply Last reply
                        0
                        • L Laxman Auti

                          kakan wrote:

                          Of course. I'm using it all the time, and still I forgot when I wrote my answer

                          Remember next time :) Knock out 't' from can't, You can if you think you can :cool:

                          K Offline
                          K Offline
                          kakan
                          wrote on last edited by
                          #13

                          I promise :)

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups