Witam
Korzystam z VS 2015 i próbuje wrzucić kod w WinApi do swojego projektu niby błędów w kodzie nie ma ale podczas kompilacji dostaje masę błędów poniżej kilka przykładów:
//kodowanie "Use Unicode Character Set"
#include "stdafx.h"
#include <string>
#include <stdlib.h>
#include <windows.h>
#include <wininet.h>
using namespace std;
HINTERNET hint, ftp;
void go()
{
HINTERNET hint, ftp;
hint = InternetOpen(L"none", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
ftp = InternetConnect(hint, L"adres do serwera ftp", INTERNET_DEFAULT_FTP_PORT, L"loginl", L"haslo", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 101);
// pobieranie
FtpGetFile(ftp, L"nazwa pliku na serwerze", L"adres do miejsca zapisu na dysku", true, FILE_ATTRIBUTE_NORMAL, INTERNET_FLAG_TRANSFER_BINARY, 0);
// wysylanie
FtpPutFile(ftp, L"miejsce na dysku z pliku", L"nazwa pliku", FTP_TRANSFER_TYPE_BINARY, 0);
}
int main()
{
return 0;
}
błędy:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol __imp__FtpPutFileW@20 referenced in function "void __cdecl go_2(void)" (?go_2@@YAXXZ) ConsoleApplication8 c:\Users\documents\visual studio 2015\Projects\ConsoleApplication8\ConsoleApplication8\ConsoleApplication8.obj 1
Error LNK1120 4 unresolved externals ConsoleApplication8 c:\users\documents\visual studio 2015\Projects\ConsoleApplication8\Debug\ConsoleApplication8.exe 1
Error LNK2019 unresolved external symbol __imp__FtpGetFileW@28 referenced in function "void __cdecl go_2(void)" (?go_2@@YAXXZ) ConsoleApplication8 c:\Users\documents\visual studio 2015\Projects\ConsoleApplication8\ConsoleApplication8\ConsoleApplication8.obj 1
Error LNK2019 unresolved external symbol __imp__InternetConnectW@32 referenced in function "void __cdecl go_2(void)" (?go_2@@YAXXZ) ConsoleApplication8 c:\Users\documents\visual studio 2015\Projects\ConsoleApplication8\ConsoleApplication8\ConsoleApplication8.obj 1
Error LNK2019 unresolved external symbol __imp__InternetOpenW@20 referenced in function "void __cdecl go_2(void)" (?go_2@@YAXXZ) ConsoleApplication8 c:\Users\documents\visual studio 2015\Projects\ConsoleApplication8\ConsoleApplication8\ConsoleApplication8.obj 1
Inny przykład:
//przestawione kodowanie w General na "Use Multi-Byte Character Set"
#include "stdafx.h"
#include <string>
#include <windows.h>
#include <wininet.h>
using namespace std;
bool Zapis(string server, string plikServ, string plikDysk)
{
HINTERNET internet = InternetOpen("tester", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC);
HINTERNET inter = InternetConnect(internet, server.c_str(), INTERNET_DEFAULT_FTP_PORT,NULL, NULL, INTERNET_SERVICE_FTP, 0, 0);
return FtpGetFile(inter, plikServ.c_str(), plikDysk.c_str(), FALSE, FILE_ATTRIBUTE_NORMAL,FTP_TRANSFER_TYPE_BINARY, 0);
}
int main()
{
return 0;
}
błędy:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol __imp__FtpGetFileA@28 referenced in function "bool __cdecl Zapis(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?Zapis@@YA_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00@Z) ConsoleApplication8 c:\Users\documents\visual studio 2015\Projects\ConsoleApplication8\ConsoleApplication8\ConsoleApplication8.obj 1
Warning C4800 'BOOL': forcing value to bool 'true' or 'false' (performance warning) ConsoleApplication8 c:\users\documents\visual studio 2015\projects\consoleapplication8\consoleapplication8\consoleapplication8.cpp 15
Error LNK1120 3 unresolved externals ConsoleApplication8 c:\users\glinka\documents\visual studio 2015\Projects\ConsoleApplication8\Debug\ConsoleApplication8.exe 1
Error LNK2019 unresolved external symbol __imp__InternetConnectA@32 referenced in function "bool __cdecl Zapis(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?Zapis@@YA_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00@Z) ConsoleApplication8 c:\Users\documents\visual studio 2015\Projects\ConsoleApplication8\ConsoleApplication8\ConsoleApplication8.obj 1
Error LNK2019 unresolved external symbol __imp__InternetOpenA@20 referenced in function "bool __cdecl Zapis(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?Zapis@@YA_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00@Z) ConsoleApplication8 c:\Users\documents\visual studio 2015\Projects\ConsoleApplication8\ConsoleApplication8\ConsoleApplication8.obj 1
Ktoś ma pomysł co z tym zrobić?
Projekt kompilowany pod VS 2015 pod Console.