我正在尝试使用名为LibLCS的库在 C++ 中模拟 C17 逻辑电路。单击此处查看使用此库制作的数字电路示例。但不工作。我无法编译代码,也不知道为什么。
#include <lcs/lcs.h>
#include <lcs/nand.h>
#include <lcs/simul.h>
#include <lcs/tester.h>
#include <lcs/changeMonitor.h>
// All libLCS constructs are defined under
// the namespace lcs.
using namespace lcs;
int main()
{
Bus<1> a, b, c, d, e, ga, gb, gc, gd, ge, gf;
Nand<2> nandGate1(ga, (a,b)), nandGate2(gb, (b,d));
Nand<2> nandGate3(gc, (c,gb)), nandGate4(gd, (gb,e));
Nand<2> nandGate5(ge, (ga,gc)), nandGate6(gf, (gc,gd));
ChangeMonitor<5> inputMonitor((a,b,c,d,e), "Input", DUMP_ON);
ChangeMonitor<2> outputMonitor((ge,gf), "Output", DUMP_ON);
Tester<5> tester((a,b,c,d,e));
Simulation::setStopTime(4000); // Set the stop time.
Simulation::start(); // Start the simulation.
return 0;
}
我收到以下编译错误:
g++ -o c17 c17.cpp /tmp/cc5TeFfF.o: In function main':
c17.cpp:(.text+0x50a): undefined reference to lcs::Simulation::setStopTime(unsigned int)'
c17.cpp:(.text+0x50f): undefined reference to lcs::Simulation::start()' /tmp/cc5TeFfF.o: In function lcs::Bus<(1)+(1)> const lcs::Bus<1>::operator,<1>(lcs::Bus<1> const&) const':
c17.cpp(.text._ZNK3lcs3BusILi1EEcmILi1EEEKNS0_IXplT_Li1EEEERKNS0_IXT_EEE[_ZNK3lcs3BusILi1EEcmILi1EEEKNS0_IXplT_Li1EEEERKNS0_IXT_EEE]+0x75):
还有很多...