OMNeT++

OMNeT++ FAQ

Rany

How to Fix "Cannot Resolve Import" Error in OMNeT++ 6.1 with INET 4.5 When Creating Custom .msg Files

Rany 1 week ago 27 views

How to Fix "Cannot Resolve Import" Error in OMNeT++ 6.1 with INET 4.5 When Creating Custom .msg Files
Hey everyone, I'm just getting started with network simulations using OMNeT++ version 6.1 alongside the INET 4.5 framework, and I'm running into a frustrating snag. I need to define a custom message in a .msg file, and I'm trying to import the TagBase class from inet.common.TagBase because it's essential for tagging packets in my setup. I've made sure to reference the inet4 library in my project settings, but every time I build, I get an error saying it can't resolve the import. I've double-checked my paths and configurations, but nothing seems to work. Is this a common beginner mistake, or am I missing something specific to this version combo? Any tips on troubleshooting this would be awesome!

Admin Answer

I ran into a similar headache when I first started tinkering with custom messages in OMNeT++ 6.1 and INET 4.5. The "cannot resolve import" issue usually pops up because the message compiler (opp_msgc) isn't picking up the correct include paths for INET's headers. First off, ensure that your project's makefile or build settings explicitly include the INET source directories—specifically, add '-I/path/to/inet/src' to your compiler flags.
Also, in your .msg file, try using the full namespace like 'import inet.common.packet.tag.TagBase;' instead of just TagBase. If that doesn't do the trick, clean and rebuild the entire project, or even restart the IDE to refresh the dependencies.
In my case, it was a path mismatch; once I updated the .nedpaths file to point to INET's common folder, it compiled smoothly. Hope that sorts it out for you!

Verified Answer Last updated: 10 hours ago

Community Replies 0 Replies

Join the discussion and share your thoughts

No Replies Yet

Be the first to share your thoughts and help the community by replying to this question.

Login to Reply

Add Your Reply

Be respectful and helpful. Provide details to support your answer.

Please log in to add a reply.