diff --git a/src/Makefile.am b/src/Makefile.am
index c562abd..e691023 100644
--- src/Makefile.am
+++ src/Makefile.am
@@ -7,7 +7,7 @@ noinst_SCRIPTS = ftpget

 EXTRA_DIST = $(pkgdata_SCRIPTS) $(bin_SCRIPTS) $(noinst_SCRIPTS)

-lftp_SOURCES = lftp.cc complete.h complete.cc lftp_rl.c lftp_rl.h attach.cc attach.h
+lftp_SOURCES = lftp.cc complete.h complete.cc lftp_rl.cc lftp_rl.h attach.cc attach.h

 TASK_MODULES = liblftp-pty.la liblftp-network.la proto-ftp.la proto-http.la proto-file.la proto-fish.la proto-sftp.la
 JOB_MODULES = cmd-mirror.la cmd-sleep.la cmd-torrent.la
diff --git a/src/complete.cc b/src/complete.cc
index bbfbfe9..1422e1c 100644
--- src/complete.cc
+++ src/complete.cc
@@ -857,7 +857,7 @@ static char **lftp_completion (const char *text,int start,int end)
    return matches;
 }

-extern "C" void lftp_line_complete()
+void lftp_line_complete()
 {
    delete glob_res;
    glob_res=0;
@@ -1286,7 +1286,7 @@ void lftp_readline_init ()
    }
 }

-extern "C" void completion_display_list (char **matches, int len)
+void completion_display_list (char **matches, int len)
 {
    JobRef<OutputJob> b(new OutputJob((FDStream *) NULL, "completion"));

--- src/complete.h.orig	2013-03-19 07:48:47.000000000 -0500
+++ src/complete.h	2016-06-13 17:23:19.000000000 -0500
@@ -26,6 +26,7 @@
 extern CmdExec *completion_shell;
 extern int remote_completion;
 int   lftp_rl_getc(FILE *);
-extern "C" void lftp_line_complete();
+void lftp_line_complete();
+void completion_display_list (char **matches, int len);
 	
 #endif //COMPLETE_H
--- src/lftp_rl.cc.orig	2016-11-14 05:00:55.000000000 -0600
+++ src/lftp_rl.cc	2016-11-17 05:21:32.000000000 -0600
@@ -25,6 +25,8 @@
 #include <readline/history.h>
 
 #include "lftp_rl.h"
+#include "misc.h"
+#include "complete.h"
 
 /* complete.cc */
 void lftp_line_complete();
@@ -143,8 +145,6 @@
    return rl_completion_matches(text,compentry);
 }
 
-void completion_display_list (char **matches, int len);
-
 void lftp_rl_display_match_list (char **matches, int len, int max)
 {
    printf("\n"); /* get off the input line */
@@ -185,7 +185,7 @@
 }
 void lftp_rl_bind(const char *key,const char *func)
 {
-   char *line=alloca(strlen(key)+2+strlen(func)+1);
+   char *line=(char*)alloca(strlen(key)+2+strlen(func)+1);
    sprintf(line,"%s: %s",key,func);
    rl_parse_and_bind(line);
 }
@@ -195,8 +195,6 @@
    rl_set_prompt(p);
 }
 
-extern char *get_lftp_data_dir();
-
 static char *lftp_history_file;
 void lftp_rl_read_history()
 {
