Closed Niuzu closed 2 years ago
The example Code given in the repository is generating a 'Segmentation fault'
dbcppp/examples/BasicUsage/main.cpp
Terminal:
Building CodeExample... Scanning dependencies of target CodeExample [ 50%] Building CXX object CMakeFiles/CodeExample.dir/main.cpp.o [100%] Linking CXX executable CodeExample [100%] Built target CodeExample Segmentation fault
main.cpp:
int main() { std::unique_ptr<dbcppp::INetwork> net; { std::ifstream idbc("TestingDbc.dbc"); net = dbcppp::INetwork::LoadDBCFromIs(idbc); } std::unordered_map<uint64_t, const dbcppp::IMessage*> messages; for (const dbcppp::IMessage& msg : net->Messages()) /* Code generates Segmentation fault */ { // messages.insert(std::make_pair(msg.Id(), &msg)); } }
You get an error, because net is nullptr. To make the example work, you have to provide your own TestingDbc.dbc.
net
TestingDbc.dbc
Correct, my dbc was in a different folder than my binary. Thanks.
The example Code given in the repository is generating a 'Segmentation fault'
dbcppp/examples/BasicUsage/main.cpp
Terminal:
main.cpp: