在ubuntu中使用make命令重新编译时出现问题
我正在尝试修改 ns2 中的一些 C++ 文件,然后使用 make 命令重新编译。虽然 make 之后创建了新的 .o 文件,但输出与之前的 C++ 文件(修改之前)类似。有人可以建议其背后的原因是什么吗?
I m trying to modify some C++ files in ns2 and then recompile using make command. Although new .o file is created after make, the output is similar to that of previous C++ file (before modifying). can someone suggest what may be the reason behind it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
确保您正在运行新构建的 ns2 可执行文件 - 如果您只输入
ns2
,您将在系统上获得已安装的 ns2 二进制文件,您没有对其进行更改(除非您执行 < code>make install 即使如此,它也可能将其安装在不同的位置,将旧的保留在原处)。一般来说,如果您想确保在当前目录中获得可执行文件(可能是您刚刚构建的目录,但请检查Makefile 和可执行文件上的日期更加确定。)
Make sure you're running your newly built ns2 executable -- if you just type
ns2
, you'll get the installed ns2 binary on the system, which you haven't changed (unless you do amake install
and even then it might install it in a different place, leaving the old one where it is).Generally you'll need to run
./ns2
if you want to make sure you get the executable in the current directory (which is probably the one you just built, but check the Makefile and the date on the executable to be more sure.)这通常意味着您没有编译您认为的内容。尝试重命名你的源文件,看看 make 是否仍然“编译”它(它不应该)。或者,确保保存编辑器中的更改。
This usually means you're not compiling what you think you are. Try renaming your source file and see if make still "compiles" it (it shouldn't). Alternatively, make sure you're saving your changes from your editor.
要获得所有构建时依赖项,您将
继续获取源代码(大约 46Mb)并编译
您就完成了。 (它在我的工作站上于 2'55" 构建了 ns2、ns2-doc 和 ns2-examples)。在源目录中,您可以编辑源代码并运行“make”或 debuild 以使用您的更改进行重建。
使用此方法时(并且debuild) 你最终会在 mkdir $HOME/ns2work 中得到 .deb 文件,这样你就可以真正干净地安装它(如果你愿意的话,可以在多台机器上安装)
祝你好运
To get all the build time dependencies, you would
Proceed to get the sources (46Mb approx) and compile
You'd be done. (it built ns2, ns2-doc and ns2-examples in 2'55" on my workstation). Inside the source directory you can edit the source and run 'make' or debuild to rebuild using your changes.
When using this method (and debuild) you will end up with .deb files in mkdir $HOME/ns2work so you can actually install it cleanly (on several machines if you want)
Good luck