简体   繁体   中英

local header files available in the project but make gives No such file or directory error

From entire day I am trying to install OverSim [ http://www.oversim.org/wiki/OverSimInstall] The make file looks like this:

all: checkmakefiles
    cd src && $(MAKE)

clean: checkmakefiles
    cd src && $(MAKE) clean

cleanall: checkmakefiles
    cd src && $(MAKE) MODE=release clean
    cd src && $(MAKE) MODE=debug clean
    rm -f src/Makefile

makefiles:
    cd src && opp_makemake -f --deep --make-so -o inet -O out $$NSC_VERSION_DEF

checkmakefiles:
    @if [ ! -f src/Makefile ]; then \
    echo; \
    echo '======================================================================='; \
    echo 'src/Makefile does not exist. Please use "make makefiles" to generate it!'; \
    echo '======================================================================='; \
    echo; \
    exit 1; \
    fi

doxy:
    doxygen doxy.cfg

tcptut:
    cd doc/src/tcp && $(MAKE)

I am using Omnet5.1.1 as omnet4.2.2 is not supported on Ubuntu16.04, my gcc version is 5.4.1.

Every time I try to build this make all, it gives header file not found error where as in actual the header files are present inside the project directory.

In file included from applications/ethernet/EtherAppCli.cc:21:0:
applications/ethernet/EtherAppCli.h:21:22: fatal error: INETDefs.h: No such file or directory

The includes are done like this:

#include "INETDefs.h" //available at src/linklayer/contract/
#include "MACAddress.h" //available at src/base/

project structure:

在此处输入图片说明 在此处输入图片说明

How could I resolve this build error?

This is a basic difference between newer OMNeT++ versions 5.x and the older OMNeT++ versions 3.x and 4.x.

As far as I remember Oversim, it was released for build with OMNeT 3.x and 4.2 as well as the older INET releases. These old versions used parameters like --deep to search for include files, that's why the included files are just named and not entered with a complete path.

The newer INET and OMNeT releases use hierarchical path settings for include files. The complete paths have to be given for the compiler to access the included file.

So for INET version 3.x and OMNeT++ version 5.x, an include looks like: #include "inet/common/INETDefs.h"

Oversim does not include the complete paths for included headers, that's why you have errors when using Oversim with newer OMNeT releases.

The first option is to either use an older OMNeT version. Either install an older GCC in parallel on your system or set-up a virtual machine with an older Ubuntu if you like.

The second (and more complex) option is to adopt all include paths or define all necessary paths via the -I option of the compiler/linker.

Frankly, I'd suggest to use the older OMNeT++ 4.2.2 version...

The #include directive searches first of all inside the same directory as the file containing the directive and then in a preconfigured list of standard system directories.

If you don't want to move the header files to the same directory as EtherAppCli.cc , you will have to add the paths to these header files to this preconfigured list, usually with the compiler option
-Ipath/to/dir
I'm not sure if this is what is intended in the app your'e compiling but this is more or less what you can do.
Check to see if you missed anything in the installation guide.

Use OMNet 4.6 instead. Keep using inet-20111118. You should be able to build inet normally. Then build Oversim

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM