Probleme beim compilen. Wo liegt der Fehler ?
-
Hi !
Ich habe zur Übung mit Hilfe der schrecklichen Dokumentation von Microsoft
eine Art FTP-Client geschrieben. Aber mir geht es jetzt nicht um den Sinn
des Programms, sondern eher um Kompilierungsfehler !
Hier mal das Programm :#pragma comment (lib, "WinInet.lib") #include <windows.h> #include <wininet.h> #include <iostream> #include <fstream> #include <string> using namespace std; string hostname = "test.te.funpic.de"; string user = "Max_Mustermann"; string password = "I_rock!"; string localfile; string ftpfile; string todeletefile; string remotefile; string newfile; int ftpx(string type) { HINTERNET hOpen, hConnection; hOpen = InternetOpen("FTP Serv", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); hConnection = InternetConnect(hOpen, hostname.c_str(), INTERNET_DEFAULT_FTP_PORT, user.c_str(), password.c_str(), INTERNET_SERVICE_FTP, 0, 0); if (type == "upload") { FtpPutFile(hConnection, localfile.c_str(), ftpfile.c_str(), FTP_TRANSFER_TYPE_BINARY, 0); } else if (type == "delete") { FtpDeleteFile(hConnection, todeletefile.c_str()); } else if (type == "download") { FtpGetFile(hConnection, remotefile.c_str(), newfile.c_str(), false, FALSE,FILE_ATTRIBUTE_NORMAL | FTP_TRANSFER_TYPE_BINARY,0); } InternetCloseHandle(hConnection); InternetCloseHandle(hOpen); } int main() { unsigned int choose; cout << "Choose something : \n \n"; cout << "- Upload File <1> \n"; cout << "- Delete File <2> \n"; cout << "- Download File <3> \n"; cout << "Your Choice : "; cin >> choose; cout << endl << endl; switch(choose) { case 1: cout << "Enter Path to local File :"; cin >> localfile; cout << endl; cout << "Enter Path for File on FTP-Server :"; cin >> ftpfile; cout << endl; ftpx("upload"); case 2: cout << "Enter Path to local File :"; cin >> todeletefile; cout << endl; ftpx("delete"); case 3: cout << "Enter Path for File on FTP-Server :"; cin >> remotefile; cout << endl; cout << "Enter Path for local File :"; cin >> newfile; cout << endl; ftpx("download"); } }Aber ich bekomme immer diese Fehlermeldungen :
C:\DOKUME1\flo\LOKALE1\Temp\ccioaaaa.o(.text+0x6a):ftpcli~1.cpp: undefined reference to
InternetOpenA@20' C:\\DOKUME~1\\flo\\LOKALE~1\\Temp\\ccioaaaa.o(.text+0xbc):ftpcli~1.cpp: undefined reference toInternetConnectA@32'
C:\DOKUME1\flo\LOKALE1\Temp\ccioaaaa.o(.text+0x10e):ftpcli~1.cpp: undefined reference toFtpPutFileA@20' C:\\DOKUME~1\\flo\\LOKALE~1\\Temp\\ccioaaaa.o(.text+0x152):ftpcli~1.cpp: undefined reference toFtpDeleteFileA@8'
C:\DOKUME1\flo\LOKALE1\Temp\ccioaaaa.o(.text+0x1b0):ftpcli~1.cpp: undefined reference toFtpGetFileA@28' C:\\DOKUME~1\\flo\\LOKALE~1\\Temp\\ccioaaaa.o(.text+0x1bf):ftpcli~1.cpp: undefined reference toInternetCloseHandle@4'
C:\DOKUME1\flo\LOKALE1\Temp\ccioaaaa.o(.text+0x1ce):ftpcli~1.cpp: undefined reference to `InternetCloseHandle@4'Wo liegt der Fehler ? Bitte verständlich erklären, bin ja nicht so der Pro :p
Ich benutze im Übrigen Dev C++ 4 .Hoffe das war das richtige Unterforum.
mfg,
flo
-
Dieser Thread wurde von Moderator/in Jochen Kalmbach aus dem Forum WinAPI in das Forum Compiler- und IDE-Forum verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.
-
Dem Linker fehlt die richtige Bibliotheksdatei (.lib) oder (.a)
-
Ich habe aber die WinInet.lib im lib Ordner von Dev-C++ .
An was könnte es denn sonst noch liegen ?
-
Kenn DevC++ das "#pragma comment(lib, ..)"!? AFAIK Nein...
-
Und wie kann ich unter Dev C++ Libs einbinden ?
mfg,
flo
-
Genau aus diesem Grunde hab ich Dich hier her verschoben

PS: Schau einfach mal ein wenig hier rum, da gibt es viele die so ein Problem miut dem DevC++ haben...
-
Und wie kann ich unter Dev C++ Libs einbinden ?
Hi,
auf meiner Homepage habe ich ein kleines Tutorial dazu geschrieben:
Viel Glück
mikey.
-
Lol, ich habs mit meiner Dev Cpp 4 Version nicht hinbekommen. Jetzt habe ich
mir Dev cpp 5 gezogen und es gibt keine Probs mehr.
@mikey : Schöne Page

Thx an alle ^^
-
Lol, ich habs mit meiner Dev Cpp 4 Version nicht hinbekommen. Jetzt habe ich
mir Dev cpp 5 gezogen und es gibt keine Probs mehr.@mikey : Schöne Page
Danke für das Kompliment

Ich glaube, das nächste mal soll ich explizit hinschreiben, dass man sich erstmal die neue Version holen soll
Naja, wenigstens hat's jetzt geklappt.MfG mikey.