Bug #2662
closedscenario template: fatal error: common.hpp: No such file or directory
100%
Description
Steps to reproduce:
- install ndnSIM
- clone ndnSIM-scenario-template
create file
ndnSIM-scenario-template/scenarios/hello.cpp
with following code:#include <ns3/ndnSIM-module.h> int main() { return 0; }
execute
./waf configure
followed by./waf
Expected: code builds
Actual: include/ns3-dev/ns3/ndnSIM/NFD/daemon/face/face.hpp:29:22: fatal error: common.hpp: No such file or directory
Files
Updated by Junxiao Shi over 9 years ago
Workaround:
AFTER installation, run attached fix-ndnSIM-NFD-includes.sh
script in /usr/local/include/ns3-dev/ns3/ndnSIM/NFD
.
This script changes all includes into relative paths.
Updated by Christian Kreuzberger over 9 years ago
Confirming this, I've ran into the same problem.
I'm not sure if fixing the includes is the solution to this, I'm pretty sure the appropriate links need to be set in the scenario templates wscript file, as the scenarios usually run very well in the ns-3/scratch subfolder.
Updated by Junxiao Shi over 9 years ago
System headers (those installed to /usr/include or /usr/local/include) should use relative paths to reference to other headers from the same package, but some headers in ns3/ndnSIM/NFD
are not using correct relative paths.
The fix-ndnSIM-NFD-includes.sh
script changes those includes to relative paths.
This step can be moved to ndnSIM's wscript before installing.
Changing scenario template's wscript or ndnSIM's .pc to add additional include search paths is incorrect, because this can cause name conflicts.
For example, if user creates a common.hpp
in the scenario, #include "common.hpp"
would find user's common.hpp
instead of NFD's common.hpp
.
Updated by Christian Kreuzberger over 9 years ago
I can absolutely see your point, and I agree with it - the problem is however not situated in the scenario, but in the original ndnSIM core.
Anyway, the problem seems to be resolved for me by checking out the latest version of the modified ns-3 (including modified build scripts - https://github.com/cawka/ns-3-dev-ndnSIM/tree/ndnSIM-v2 ) and then re-compiling the whole thing.
Though I would prefer to have relative includes within ndnSIM - at least for files that are included in scenarios.
Updated by Alex Afanasyev about 9 years ago
- Status changed from New to Closed
- Target version set to 2.1
- % Done changed from 0 to 100
Updated by Zhiyi Zhang over 6 years ago
Will anyone fix this? This problem still exists even after two years. I got similar problem caused by the same problem.
/usr/local/include/ns3-dev/ns3/ndnSIM/model/ndn-common.hpp:38:10: fatal error: 'NFD/daemon/face/face.hpp' file not found
#include "NFD/daemon/face/face.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~~
After I change it to #include "../NFD/daemon/face/face.hpp", this error got fixed but new more errors came :(. All because of include path.