请帮我。我尝试编译用 c++ 编写的 hello world 包。我的环境是操作系统:Ubuntu 14.4,synology 工具链是 bromolow 64 位编译器,但我无法获得 helloworld.cgi。我不知道原因。源代码是
#include "webman.h"
#include <string>
#include <stdio.h>
#include <synosdk/proc.h>
using namespace std;
int main(int argc, char* argv[]) {
WebMan _cgi;
Json::Value out;
out["uname"] = "helloworld";
out["ret"] = true;
out["success"] = true;
_cgi.WriteHeader();
_cgi.WriteBody(out);
return 0;
}
并且制作文件是
.PHONY: all clean
.SUFFIXES: .cgi
CXXFLAGS=$(shell pkg-config libdsm --cflags)
LDFLAGS+=$(shell pkg-config libdsm --libs)
CXXFLAGS+=-I/usr/syno/nclude/gpl \
-I/usr/syno/include/synocgi \
# source files
SRC=${cgi_name}.cpp
CGI=$(SRC:%.cpp=../%.cgi)
all: $(CGI)
../%.cgi: %.cpp
echo $(CXX) -o $@ $^ $(CFLAGS) $(LDFLAGS)
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
clean:
rm -f core *~ *.o $(CGI)
我收到了这样的错误
======= Run build script =======
make: *** No rule to make target `distclean'. Stop.
==> cgi
==> js
<== js
/usr/local/i686-linux-gnu/bin/i686-linux-gnu-ccache-g++ -o ../helloworld.cgi helloworld.cpp -I/usr/local/i686-linux-gnu/include -DSYNO_X64 -O2 -I/usr/syno/include -g -DSYNO_PLATFORM=X64 -g -DSDK_VER_MIN_REQUIRED=400 -L/usr/local/i686-linux-gnu/lib -L/usr/syno/lib -Wl,-rpath-link -Wl,/usr/syno/lib -L/usr/local/i686-linux-gnu/lib -L/usr/syno/lib -L/source/libsynocgi/lib -L/usr/syno/sqlite3/lib/ -L/source/libsynoacl/lib/ -L/source/libsynosdk/gpl/ -L/source/google-authenticator-1.x -lsynocgi -ljson -lsynowireless-core -lsynoacl -lsynogpl -lsynocoregpl -lsynobandwidth -lsynowimax -lsynosdk -lsynocore -lcrypt -lnet -licui18n -licuuc -licudata -lxml2 -lattr -lm -ldl -lz -lsqlite3 -lgoogleauth -ldsm
/usr/local/i686-linux-gnu/lib/gcc/i686-linux-gnu/4.2.1/../../../../i686-linux-gnu/bin/ld: cannot find -lnet
collect2: ld returned 1 exit status
make[2]: *** [../helloworld.cgi] Error 1
make[1]: *** [cgi] Error 2
make: *** [ui] Error 2
There is no install-dev scripts for helloworld.
Time cost: 00:00:03 [Build-->helloworld]
I got the following error:
make[2]: *** [../helloworld.cgi] Error 1
make[1]: *** [cgi] Error 2
make: *** [ui] Error 2