Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 04-22-2006, 11:53 PM   #1 (permalink)
jevaly
forum troll
 
jevaly's Avatar
 
Join Date: Apr 2006
Location: home
Posts: 1
jevaly is on a distinguished road
linker problem with wininet

I'm trying to create a function transfer that transfers a file with ftp to an external host. Code is as follows:
Code:
#include "wininet.h"
int transfer(string filenaam,int n){
	char * programmanaam="VOP";
	char * servernaam="1.2.3.4";
	char * username="anonymous";
	char * password="hallo";
	char * directory;
	if(n==1){
		directory="c:/VOP/movies";
	}
	else if(n==2){
		directory="c:/VOP/pictures";
	}
	else{
		return ONGELDIGE_KEUZE_DIRECTORY;
	}
	LPCWSTR direc=(LPCWSTR)directory;
	LPCWSTR user=(LPCWSTR)username;
	LPCWSTR pass=(LPCWSTR)password;
	LPCWSTR server=(LPCWSTR)servernaam;
	LPCWSTR pn=(LPCWSTR)programmanaam;
	LPCWSTR file=(LPCWSTR)filenaam.c_str();
	HINTERNET handle=InternetOpen(pn,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,INTERNET_FLAG_ASYNC);
	HINTERNET ftphandle=InternetConnect(handle,server,INTERNET_DEFAULT_FTP_PORT,user,pass,INTERNET_SERVICE_FTP,INTERNET_FLAG_PASSIVE,DW_CONTEXT);
	if(FtpSetCurrentDirectory(ftphandle,direc)){
FtpPutFile(ftphandle,file,file,FTP_TRANSFER_TYPE_BINARY,DW_CONTEXT);
	}
	else{
		FtpCreateDirectory(ftphandle,direc);
		FtpSetCurrentDirectory(ftphandle,direc);
		FtpPutFile(ftphandle,file,file,FTP_TRANSFER_TYPE_BINARY,DW_CONTEXT);
	}
	InternetCloseHandle(ftphandle);
	InternetCloseHandle(handle);
	return 0;
My compiler (visual studio 2005) builds the code but keeps giving the following set of errors:
Quote:
internet.obj : error LNK2019: unresolved external symbol __imp__InternetCloseHandle@4 referenced in function "int __cdecl transfer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int)" (?transfer@@YAHV?$basic_string@DU?$char_traits@D@s td@@V?$allocator@D@2@@std@@H@Z)
internet.obj : error LNK2019: unresolved external symbol __imp__FtpCreateDirectoryW@8 referenced in function "int __cdecl transfer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int)" (?transfer@@YAHV?$basic_string@DU?$char_traits@D@s td@@V?$allocator@D@2@@std@@H@Z)
internet.obj : error LNK2019: unresolved external symbol __imp__FtpPutFileW@20 referenced in function "int __cdecl transfer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int)" (?transfer@@YAHV?$basic_string@DU?$char_traits@D@s td@@V?$allocator@D@2@@std@@H@Z)
internet.obj : error LNK2019: unresolved external symbol __imp__FtpSetCurrentDirectoryW@8 referenced in function "int __cdecl transfer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int)" (?transfer@@YAHV?$basic_string@DU?$char_traits@D@s td@@V?$allocator@D@2@@std@@H@Z)
internet.obj : error LNK2019: unresolved external symbol __imp__InternetConnectW@32 referenced in function "int __cdecl transfer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int)" (?transfer@@YAHV?$basic_string@DU?$char_traits@D@s td@@V?$allocator@D@2@@std@@H@Z)
internet.obj : error LNK2019: unresolved external symbol __imp__InternetOpenW@20 referenced in function "int __cdecl transfer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int)" (?transfer@@YAHV?$basic_string@DU?$char_traits@D@s td@@V?$allocator@D@2@@std@@H@Z)
C:\Documents and Settings\Jeroen\Mijn documenten\Visual Studio 2005\Projects\VOP\Debug\VOP.exe : fatal error LNK1120: 6 unresolved externals
at first I thought my compiler couldn't find the wininet.h file or the related binary, but when I checked I noticed this wasn't the case. Any help?
jevaly is offline   Reply With Quote
Old 04-23-2006, 04:58 AM   #2 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 705
DJMaze is on a distinguished road
You need Windows NT to use the unicode versions.
http://libunicows.sourceforge.net/
DJMaze is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
parse error problem in game.. can't seem to find problem solution. slashdot Standard C, C++ 5 08-03-2005 08:15 PM
JSP code problem j.gohel Java 7 04-15-2005 02:07 PM
Hashing problem jodders Standard C, C++ 1 02-09-2005 01:51 PM
Problem Assignment (Urgent help req.) Boltress Standard C, C++ 0 01-12-2005 07:59 AM
Help debugging a power problem Belisarius Lounge 0 10-25-2003 04:44 PM


All times are GMT -8. The time now is 02:55 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting