My code:
#include <fcgi_stdio.h>
int main() {
int count = 0;
while(FCGI_Accept() >= 0) {
printf("Content-type: text/html\r\n");
printf("\r\n");
printf("Hello world!<br>\r\n");
printf("Request number %d.", count++);
}
}
In a fresh instance of multipass, I installed gcc
, g++
and libfcfgi-dev
as
sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install libfgci-dev
But attempting to compile the code using g++ -std=c++17 -lfgci++ -lfcgi main.cpp -o main
gives the error
in function main: undefined reference to `FCGX_Init` ...
But this doesn't happen when I try to compile in gcc:latest
docker container. The dockerfile is
FROM gcc:latest
RUN apt-get update -yqq;
apt-get install -yqq libfcgi-dev
COPY ./main.cpp /home/main.cpp
CMD g++ -std=c++17 /home/main.cpp -lfcgi++ -lfcgi -o /home/main
What am i missing in the multipass instance?