pkg-config和它的参数需要被包含在引号里,而且这个引号是键盘左上角的那个 ` 如:g++ test.cpp -o test `pkg-config --cflags --libs opencv`