DBC Runtime Error

Issue #5 closed
Venkatesan SoundiraRajan created an issue

Hi,

I'm getting an error, while running DBC file reading sample code in VS2013. The code sample,

#include <iostream>
#include <fstream>

#include "Vector\DBC.h""
#include "Vector\DBC\Network.h"
#include "Vector\ASC.h"
#include <Vector\ASC\CanMessage.h>
using namespace Vector;


int main(int argc, char *argv[])
{
    DBC::Network network;
    DBC::File Nfile; 



    /* load database file */
    if (Nfile.load(network, "D:\\Public\\Myinstall\\VectorCAN\\include\\Vector\\DBC\\tests\\unittests\\data\\Database.dbc") != Vector::DBC::Status::Ok) {
        return EXIT_FAILURE;
    }

    /* loop over messages */
    for (auto message : network.messages) {
        std::cout << "Message " << message.second.name << std::endl;

        /* loop over signals of this messages */
        for (auto signal : message.second.signals) {
            std::cout << "  Signal " << signal.second.name << std::endl;
        }
    }
}

I can understand the error is because file reading and I have copied Vector_DBC.dll to exe path. Untitled1.png

I couldn't debug the code to resolve. So can you give a suggestion to resolve this issue.

Thanks in Advance.

Comments (15)

  1. thomas lintanf

    Hi,

    I have the same issue, it looks like there are some files missing. At least vector_dbc_export.h which is included in Network.h but not present in the directory.

    I hope it will be fixed soon.

  2. Venkatesan SoundiraRajan reporter

    Hi

    Thanks for the immediate response.

    Actually I have kept vector_dbc_export.h file in the same Network.h directory. but the same error is error coming. For your information, I have removed VECTOR_DBC_EXPORT part in the over all DBC package and linked with my sample project code, It's working fine with MinGW compiler in Qt Creator(I couldn't check with MSVS compiler, due to some issue with compiler in Qt).

    Please let me know, if the issue is resolved or give me some idea. So I can try in my side as much possible.

    Thank you.

  3. Tobias Lorenz repo owner

    Hi,

    I think we are discussing three issues here:

    1. It looks like the parser is unable to read the file due to some syntax issues. It is possible that you send me the file, so I can take a look in it?
    2. The vector_dbc_export.h is a file that gets generated by the CMake's generate_export_header function. This file defines the VECTOR_DBC_EXPORT macro for your particular compiler. So that the file is missing, is actually intended ;-)
    3. Unable to compile using VS2013: This I need to analyze first. I'm currently setting up a new CI/CT environment that takes more compilers into account, including VS2013/2015/2017. This is also required for Vector::BLF: See https://bitbucket.org/tobylorenz/vector_blf/issues/9.

    By the way In my case (gcc, Debian Linux) the vector_dbc_export.h contains:

    #define VECTOR_DBC_EXPORT __attribute__((visibility("default")))
    

    Bye Tobias

  4. Tobias Lorenz repo owner
    • changed status to open

    The DBC file seems to contain a syntax, that the library is unable to handle. The question is, who is the culprit, the file or the library. ;-)

    Also compilation with VS2013 might have some issues.

  5. Venkatesan SoundiraRajan reporter

    Thanks for the input,

    1. Here, I have used sample dbc, which is in the same DBC package as a example and hope I can read the database.dbc by without cmake compilation as like source code(Vector_DBC). Once again I will check and share the screenshot for the reference.

    2. Yes I accept your point and I have verified vector_dbc_export.h content. I'm guessing, the cmake compilation part creating some file routing miss match.

    3.good to hear, working on new CI/CT environment. The compiled Vector_ASC.dll can help to read the .asc file by vs2013 compiler.

    So, Maybe this is the reason :

    https://bitbucket.org/tobylorenz/vector_blf/issues/9

    Or Need to concentrate on vector_dbc_export.h part.

    I will check the source vector DBC code in vs2013 the same example file and I will update you.

    So it will help us to take the next step.

    I think file and library both are good.

    Once again thanks for the help.

  6. Venkatesan SoundiraRajan reporter

    Hi, This is the output screenshot of database.dbc file reading in Qt Creator with MinGW. Here, I didn't used dll part of DBC support. Untitled2.png

    Thank you.

  7. Tobias Lorenz repo owner

    Hi Venkat,

    that sound good. So you were able to compile the library and the screenshot shows a loaded database. So, did you had to change anything in the DBC file to get it loaded, or is it working now? ... you also wrote that you haven't used all parts of the library.

    Bye Tobias

  8. Venkatesan SoundiraRajan reporter

    Hi,

    Here, I just used Vector_DBC as a supported source code with my application.

    you are suggested to use as a CMake compiled library.

    I have an issue(RUN time error), while used as a compiled library(*.dll) with same DBC file.

    I didn't change anything on the DBC file and I have wrote that I haven't used Vector_DBC.dll of the library.

    Thank you.

  9. Venkatesan SoundiraRajan reporter

    Hi,

    Very sorry, I forget to update you, what changes I made on the Vector_DBC package to make runnable code with my compiler. I have made changes on month ago, so I forget to remember.

    #include <Vector/DBC/Message.h> into #include <DBC/Message.h>
    namespace Vector { into namespace Vector_m {
    same way I have changed in all .cpp files and  I have changed following variable name in canMessage.cpp.
    
     signals(), into  signalss(),
    

    This modified package able to run with VS2013 & MinGW compiler in My PC.

    Thank you.

  10. Tobias Lorenz repo owner

    In C++ you can use namespace aliases. So it might have been easier, if you just would have declared

    namespace Vcetor_m = Vector;
    

    Why was the renaming of signals into signalss necessary? Is this because Qt uses signals as a macro? This can be disabled with "CONFIG += no_keywords", and you can then use Q_SIGNALS instead. Qt handles this internally in the same way.

  11. Venkatesan SoundiraRajan reporter

    Thanks for your suggestions. That time I have tried many ways to resolve the errors(followed by not proper coding). So this is one of the way. Now it's working well and I can read the data.

    Very Sorry for delay response, due to system OS issues.

    Thanks Once again..

  12. Log in to comment