title: OMNeT++: Error in module during network setup: Class not found
body: <p>I created my first OMNeT++/veins project, but can’t start the simulation. 
  Can you help me?</p>
  
  <p><strong>I would like to change my question - is there a simple way to create a project, similar to RSUExampleScenario of veins, not under veins/examples/myfolder, but in a separate project and workspace? And what steps must I do for it?</strong></p>
  
  <p>I wanted to create a project similar to RSUExampleScenario from veins, but with other scenario and using other OMNeT++ modules. As I created my project under veins/examples/myfolder, and put my new .ned files under veins structure, it worked fine. </p>
  
  <p>Now I created new project, including folders with .ned and c++/h files, like folder <em>connection</em> (Connection.ned, Connection.cc, Connection.h, package.ned) and folder <em>node</em> (CloudVehicleScenarioMessage.ned, Cloud.ned) and simulation folder <em>cloudvehiclehi</em> (omnetpp.ini).</p>
  
  <p>When I start a simulation I receive the error:</p>
  
  <p><em> Error in module (cCompoundModule) CloudVehicleScenarioMessage (id=1) during network setup: Class "Connection" not found -- perhaps its code was not linked in, or the class wasn't registered with Register_Class(), or in the case of modules and channels, with Define_Module()/Define_Channel().</em></p>
  
  <p>I guess the NED files are loaded, but the classes in c++ files cannot be found, though I used <em>Define_Module</em>. Cloud is just a compound module, without any own c++ implementations, it creates no problems. Connection is a simple module, referring to class Connection.cc, where Define_Module() is called and causes the error while loading.
  All my folders, like <em>node</em> or <em>connection</em> are included, as I can see under <strong>Project->Properties->Paths and Symbols->Includes</strong>.</p>
  
  <p>I already tried to rebuild OMNeT++ (as told here  <a href="https://www.linkedin.com/grp/post/3801609-234767834" rel="nofollow noreferrer">https://www.linkedin.com/grp/post/3801609-234767834</a>) and to define namespaces for my classes (as told here <a href="https://stackoverflow.com/questions/4385469/problem-in-defining-a-module-in-omnetpp">Problem in defining a module in omnetpp</a>), but it didn’t help. </p>
  
  <p>I proved my makefile and the folders were linked in (as told here <a href="https://groups.google.com/forum/#!topic/omnetpp/Cl48hVgkbQ0" rel="nofollow noreferrer">https://groups.google.com/forum/#!topic/omnetpp/Cl48hVgkbQ0</a>).</p>
  
  <p>CloudVehicleScenarioMessage.ned is my network in omnetpp.ini.</p>
  
  <p>nodes/CloudVehicleScenarioMessage.ned:</p>
  
  <pre><code>package cloudbasedcsw.nodes;
  
  import cloudbasedcsw.nodes.ScenarioMobility;
  import cloudbasedcsw.nodes.Cloud;
  import cloudbasedcsw.connection.Connection;
  
  network CloudVehicleScenarioMessage extends ScenarioMobility
  {
  @display("bgb=540,555");
  submodules:
      cloud[1]: Cloud {
          @display("p=150,140;b=10,10,oval");
      }
      con: Connection {
          @display("p=200,40;b=10,10,oval");
      }
  }
  </code></pre>
  
  <p>ned file of module Connection:</p>
  
  <p>connection/Connection.ned</p>
  
  <pre><code>package cloudbasedcsw.connection;
  
  simple Connection{
      @class(CloudBasedCSW::Connection);
  }
  </code></pre>
  
  <p>Class Connection, which can not be found:</p>
  
  <p>connection/Connection.cc</p>
  
  <pre><code>#include &lt;Connection.h&gt;
  #include &lt;VehicleListener.h&gt;
  #include &lt;iostream&gt;
  using CloudBasedCSW::Connection;
  
  Define_Module(CloudBasedCSW::Connection);
  
  void Connection::initialize(int stage){
  
  }
  
  void Connection::connectToCloud(cModule* node){
  }
  
  void Connection::disconnectFromCloud(cModule* node){
  }
  </code></pre>
  
  <p>Connection.h</p>
  
  <pre><code>#ifndef CONNECTION_H_
  #define CONNECTION_H_
  #include &lt;omnetpp.h&gt;
  
  namespace CloudBasedCSW{
  
  class Connection: public cSimpleModule{
  public:
      cModule* scenario;
      void connectToCloud(cModule* node);
      void disconnectFromCloud(cModule* node);
  protected:
      virtual void initialize(int stage);
  private:
      cModule* cloud;
      int currentId;
      int gateCloudInId;
      int gateCloudOutId;
  };
  
  }
  #endif /* CONNECTION_H_ */
  </code></pre>