Home
Support

Knowledge Base

BSPs and drivers
Community resources
Product documentation
Questions?
Contact us

Problems linking pci library to cpp program
 
________________________________________________________________________

Applicable Environment
________________________________________________________________________
  • Topic: cpp program: linking to pci library results in undefined reference errors
  • SDP: 7.0.0
  • Target: All supported targets
________________________________________________________________________

Issue
________________________________________________________________________

I am building my cpp application code. How do I resolve the following pci linker errors:

undefined reference to `pci_device_find(unsigned int, unsigned short, unsigned short, unsigned int)'
undefined reference to `pci_device_attach(unsigned int, pci_attachFlags_t, pci_err_t*)'

________________________________________________________________________

Solution
________________________________________________________________________

The QNX7 PCI library is written in C. Linking libpci.so to a C++ program can results in the error "undefined reference to pci_device_read_vid" for example if the header files is included as

#include <pci/pci.h>

You should instead include the header file with this instruction

extern "C" {
#include <pci/pci.h>
}

________________________________________________________________________
NOTE: This entry has been validated against the SDP version listed above. Use caution when considering this advice for any other SDP version. For supported releases, please reach out to QNX Technical Support if you have any questions/concerns.
________________________________________________________________________


Related Attachments
 None Found





Please contact us with your questions or concerns.