question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compile error in VhpiCbHdl.cpp: expected ‘)’ before ‘PRIu32’

See original GitHub issue

I’m getting the following error:

  In file included from cocotb/share/include/gpi.h:60,
                   from cocotb/share/lib/vhpi/../gpi/gpi_priv.h:32,
                   from cocotb/share/lib/vhpi/VhpiImpl.h:31,
                   from cocotb/share/lib/vhpi/VhpiCbHdl.cpp:29:
  cocotb/share/lib/vhpi/VhpiCbHdl.cpp: In member function ‘virtual GpiIterator::Status VhpiIterator::next_handle(std::string&, GpiObjHdl**, void**)’:
  cocotb/share/lib/vhpi/VhpiCbHdl.cpp:1150:69: error: expected ‘)’ before ‘PRIu32’
   1150 |         LOG_DEBUG("Unable to get the name for this object of type " PRIu32, type);
        |                                                                     ^~~~~~
  cocotb/share/include/gpi_logging.h:52:98: note: in definition of macro ‘LOG_DEBUG’
     52 | #define LOG_DEBUG(...)     gpi_log("cocotb.gpi", GPIDebug,         __FILE__, __func__, __LINE__, __VA_ARGS__);
        |                                                                                                  ^~~~~~~~~~~
  cocotb/share/include/gpi_logging.h:52:35: note: to match this ‘(’
     52 | #define LOG_DEBUG(...)     gpi_log("cocotb.gpi", GPIDebug,         __FILE__, __func__, __LINE__, __VA_ARGS__);
        |                                   ^
  cocotb/share/lib/vhpi/VhpiCbHdl.cpp:1150:9: note: in expansion of macro ‘LOG_DEBUG’
   1150 |         LOG_DEBUG("Unable to get the name for this object of type " PRIu32, type);
        |         ^~~~~~~~~
  error: command 'gcc' failed with exit status 1

This came in via #1361 (https://github.com/cocotb/cocotb/pull/1361/files#diff-8baf84ef545a81134ec388a5b271c5b6R1131).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:21 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
cmarqucommented, Feb 21, 2020

If I include<cinttypes> before "inttypes.h" in https://github.com/cocotb/cocotb/blob/master/cocotb/share/include/vpi_user.h#L40, then it works.

My inttypes.h has the definition of PRIu32 et al. wrapped as follows:

/* The ISO C99 standard specifies that these macros must only be
   defined if explicitly requested.  */
#if !defined __cplusplus || defined __STDC_FORMAT_MACROS
0reactions
cmarqucommented, Mar 9, 2020

Thanks for the confirmation. It will make its way into cocotb, we just haven’t decided on the method to use yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why doesn't PRIu64 work in this code? - c++ - Stack Overflow
h , the compiler doesn't include it again, and doesn't see the declaration of __STDC_FORMAT_MACROS . The solution is either to edit Utils.h...
Read more >
error: expected ')' before 'PRIu64' - C Board
error : expected ')' before 'PRIu64'. I'm trying to compile the below code just to see the numeric size of an unsigned 64...
Read more >
error: expected ')' before '*' token
I have source file parser.c, which compiled fine. However, I need to call some functions in general.c from parser.c, so I added #include...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found