sudo apt-get install m4 autoconf perl cd ~ mkdir cgicc wget ftp://ftp.gnu.org/gnu/cgicc/cgicc-3.2.16.tar.gz tar xvf cgicc-3.2.16.tar.gz cd cgicc-3.2.16 ./configure --prefix=/usr make sudo make install cd /usr/lib ls libcgi*
source: http://derekmolloy.ie/beaglebone-cgicc/
sudo apt-get install libmysql++ libmysql++-dev
source: https://sandeepghai.wordpress.com/2011/08/07/linking-of-mysql-database-with-c-on-linux-machine/
buat file cgi dengan nama test.cpp dan isikan kode berikut:
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <cgicc/CgiDefs.h>
#include <cgicc/Cgicc.h>
#include <cgicc/HTTPHTMLHeader.h>
#include <cgicc/HTMLClasses.h>
using namespace std;
using namespace cgicc;
int main () {
Cgicc formData;
cout << "Content-type:text/html\r\n\r\n";
cout << "<html>\n";
cout << "<head>\n";
cout << "<title>Menggunakan GET</title>\n";
cout << "</head>\n";
cout << "<body>\n";
form_iterator nama = formData.getElement("nama");
if( !nama->isEmpty() && nama != (*formData).end()) {
cout << "Halo " << **nama << endl;
} else {
cout << "Nama tidak diisikan" << endl;
}
cout << "<br/>\n";
cout << "</body>\n";
cout << "</html>\n";
return 0;
}
lalu compile dengan perintah
g++ -o test test.cpp -lcgicc
coba buka dengan
test?nama=latiful
sumber: https://www.tutorialspoint.com/cplusplus/cpp_web_programming.htm