Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

c2h error at bitmap header declaration

Hi everyone,

I am trying to accelerate a function func_acc(). However i am getting an error during the c2h compilation. What puzzles me is that the error is triggered at the main() function, not even at the function where i am accelerating.The error is:

../mand_sw.c:112: PARSE ERROR, ../mand_sw.c line 112 column 20

ERROR:

C2H:0: C2H ERROR: "d:/altera/90/nios2eds/components/altera_avalon_c_hardware_accelerator/lex_and_yacc/c2h_cparse.exe" "P:/work/altera_c2h/sw/mandelbrot_sw/Debug/obj/mand_sw.c2h_pre"

And the code at line 112 is:

BITMAPFILEHEADER header; /* Bitmap header */

The error message is hardly helpful. Anybody who knows what is wrong here?

One more thing; the code compiles nicely in the software only implementation.

Thanks!

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    you should have a look at the lines before line 112, and the definition of BITMAPFILEHEADER. With those kind of errors, the compiler hardly ever indicates the correct line for the error.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The c2h compiler is weird. It throws error at printf coded before the data declaration finishes:

    double xmax, xmin, ymax, ymin, dx, dy;

    printf ("C2h screams this is illegal"); /*Error occurs here*/

    BITMAPFILEHEADER header;

    BITMAPINFOHEADER bmiHeader;

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    No, not really, the C standard (prior to C99) required all variable definitions to be at the start of a block.

    This is actually a good idea - it makes them much easier to find.