Ubuntu 用g+编译+;,can';不要更改库路径

Ubuntu 用g+编译+;,can';不要更改库路径,ubuntu,g++,Ubuntu,G++,我好像没法让它工作。我有一个C++脚本,我还没有自己编写,我需要用G++编译。脚本的开头如下所示: #include "x.hh" #include "y.hh" #include <iostream> ... 这将返回错误: /usr/bin/ld cannot find -lx /usr/bin/ld cannot find -ly collect2 returned 1 exit status 搜索路径与我指定的不同。即使我写 g+

我好像没法让它工作。我有一个C++脚本,我还没有自己编写,我需要用G++编译。脚本的开头如下所示:

#include "x.hh"
#include "y.hh"

#include <iostream>
...
这将返回错误:

/usr/bin/ld cannot find -lx
/usr/bin/ld cannot find -ly
collect2 returned 1 exit status
搜索路径与我指定的不同。即使我写

g++ Documents/Cpp/script.cc -o script -L sdfsdf/sdfsd-lx -ly

它仍在/usr/bin/ld文件夹中查找。不管我写什么,我都不能让它工作。如何编译?

编译所有.cc文件,它们都是构建程序所必需的

g++ Documents/Cpp/*.cc sdfsdf/*.cc -o script

(假设
sdfsdf
是x.cc和y.cc的路径)

x.hh
是头文件。库通常称为
libx。因此,在Linux下
#include
中的引号与链接无关。尝试链接没有<代码> -LX-LY ,那些库似乎不存在。如果我删除-LX和-LY,我会得到很多错误信息,看起来像:Script .cc::(.text +0x26d)未定义的引用“x::x())脚本。cc:(.text +0x26d)未定义的引用“y::y-())@ USER 28 1233,并再次阅读关于编译C++代码的教程,关于什么是图书馆;)
g++ Documents/Cpp/*.cc sdfsdf/*.cc -o script