riebl / artery

OMNeT++ V2X simulation framework for ETSI ITS-G5
GNU General Public License v2.0
203 stars 129 forks source link

Help needed: "NED module type ... not found (fully qualified type name expected)" #280

Closed HuyTyskland closed 1 year ago

HuyTyskland commented 1 year ago

Hello everyone,

Currently, I am having a weird error. The issue is as follow:

  1. I defined a service for a platoon member: with MService.cc, MService.h, and network module MService.ned. In MService.cc, I Define_Module(MService).
  2. In the file services.xml for service configuration of omnetpp.ini file, I indicate the service as below: `
    <filters><name pattern="m.*" /></filters>

    `

However, I have an error as "NED module type MService not found (fully qualified type name expected". I put the MService.cc/.h/.ned, services.xml, and omnetpp.ini in one folder. Other service modules also have the same issue.

What might be the cause of this issue? I am not sure if I miss any step from Artery chapter from the book Recent Advances in Network Simulation.

Kind regards, Huy Nguyen.

riebl commented 1 year ago

Have you added your sources to CMake?

HuyTyskland commented 1 year ago

Yes I did. I created a CMakeLists.txt (scenarios/my_scenario/CMakeLists.txt) for the folder of my scenario in scenarios. I also used add_subdirectory for my scenario in the CMakeLists.txt (scenarios/CMakeLists.txt) of scenarios folders.

riebl commented 1 year ago

Good. Did you also add the folder containing your MService.ned via the add_opp_run CMake macro and its NED_FOLDERS argument?

HuyTyskland commented 1 year ago

I only did add_subdirectory(my_scenario) in artery/scenarios/CMakeLists.txt. I will do the add_opp_run in that CMakeLists.txt too.

HuyTyskland commented 1 year ago

I just added add_opp_run(my_scenario WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/my_scenario) but there is an error: (the step1_multilane_noConsideration is my_scenario for easier typing btw)

CMake Error at cmake/AddOppRun.cmake:105 (add_custom_target):
  add_custom_target cannot create target
  "run_step1_multilane_noConsideration" because another target with the same
  name already exists.  The existing target is a custom target created in
  source directory
  "/home/huytyskland/src/artery_thesis/scenarios/step1_multilane_noConsideration".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  scenarios/CMakeLists.txt:42 (add_opp_run)

-- Configuring incomplete, errors occurred!
See also "/home/huytyskland/src/artery_thesis/build/CMakeFiles/CMakeOutput.log".
See also "/home/huytyskland/src/artery_thesis/build/CMakeFiles/CMakeError.log".
make: *** [Makefile:32856: cmake_check_build_system] Error 1
HuyTyskland commented 1 year ago

Ah I added in the wrong file. I deleted that add_opp_run in artery/scenarios/CMakeLists.txt and added the add_opp_run in the artery/scenarios/my_scenario/CMakeLists.txt. I added add_opp_run(my_scenario NED_FOLDERS ${CMAKE_CURRENT_SOURCE_DIR}). here is an error as below:

<!> Error: The following NED types could not be fully resolved due to a missing base type or interface: LLService, MService, NPService, PLService

End.
make[3]: *** [scenarios/step1_multilane_noConsideration/CMakeFiles/run_step1_multilane_noConsideration.dir/build.make:57: scenarios/step1_multilane_noConsideration/CMakeFiles/run_step1_multilane_noConsideration] Error 1
make[2]: *** [CMakeFiles/Makefile2:1729: scenarios/step1_multilane_noConsideration/CMakeFiles/run_step1_multilane_noConsideration.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1736: scenarios/step1_multilane_noConsideration/CMakeFiles/run_step1_multilane_noConsideration.dir/rule] Error 2
make: *** [Makefile:643: run_step1_multilane_noConsideration] Error 2
HuyTyskland commented 1 year ago

So far, I have been working with Artery in VSCode. However, when I view my project via Omnetpp and view the .ned file, there is a notification ("Not a NED file" as a title) from omnetpp saying that:

This NED file is not under a NED source folder or is in an excluded NED package, and will be opened in a standard text editor. If you want to edit it graphically, please move it into a NED source folder or remove package exclusion. NED Source Folders and package exclusion can be configured in the Project Properties dialog

Should that be the problem? I assume it isn't since the same notification happened with police-highway but that scenario can still be run.

HuyTyskland commented 1 year ago

I figured out the cause of error. I made a grammar mistake in those .ned files: instead of import artery.application.ItsG5Service;, I put import artery.application ItsG5Service;. That's why services cannot recognize those .ned files.

@riebl thank you for your help. and sorry about my carelessness.