I'm trying to pass a string as a C++ template parameter, but I can't seem to be able to get it to work. For the record, I'm working with the SystemC library (hence all the sc_xxx stuff). According to this answer, what I'm doing should work, but I cannot see what I'm doing wrong. The compiler is telling me that " filePath
cannot appear in a constant" expression." Any help would be appreciated.
main.cpp
int sc_main(int argc, char* argv[])
{
const char filePath[] = "test.txt";
Interconnect<sc_uint<32>, filePath, 10> myInterconnect;
return 0;
}
interconnect.h
template<class T, const char filePath[], unsigned nPortPairs = 10>
SC_MODULE(Interconnect)
{
public:
...
};