Bug #2662
closed
scenario template: fatal error: common.hpp: No such file or directory
Added by Junxiao Shi over 9 years ago.
Updated almost 7 years ago.
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
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.
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.
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
.
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.
- Status changed from New to Closed
- Target version set to 2.1
- % Done changed from 0 to 100
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.
Also available in: Atom
PDF