我已经按照文档中的说明在 c++ 文件中声明了一个函数,并在 .ned 文件中调用了它。但它给出了以下错误。
error:expected constructor, destructor, or type conversion before ‘(’ token Define_Function(dijkstra, 1);
以下是我的 c++ 文件。
#include <omnetpp.h>
#include "stdio.h"
#include "Node.h"
#include "cdelaychannel.h"
Define_Function(dijkstra, 1);
double dijkstra(double start = 1){
....
....
}
在我的网络描述文件中,我调用了该函数。
package myproject;
@license(LGPL);
dijkstra(1.0);
为什么它给我错误?