Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integration with C++ / QT not working #6

Closed
vlotech opened this issue Jul 6, 2015 · 3 comments
Closed

integration with C++ / QT not working #6

vlotech opened this issue Jul 6, 2015 · 3 comments

Comments

@vlotech
Copy link

vlotech commented Jul 6, 2015

Hi,

I've tried to integrate the licbor into a QT lib. I've been running in several issues, all related in C99 C++11 related features. The lib is statically build and could be integrated easily, except that the headers generate errors while building:

  • restrict not supported:
    ../../lib/qt/libcbor-qt/libcbor-0.3.1/src/cbor/bytestrings.h:62:79: error: expected ',' or '...' before 'data'
    void cbor_bytestring_set_handle(cbor_item_t *item, cbor_mutable_data restrict data, size_t length);
  • initializer not supported
    ../../lib/qt/libcbor-qt/libcbor-0.3.1/src/cbor/callbacks.h:224:1: sorry, unimplemented: non-trivial designated initializers not supported

Using -std=c++11 nor -std=c99 (which fails for c++ / qt anyhow) doesn't solve the issue.

What can be done to solve it?

@PJK
Copy link
Owner

PJK commented Dec 25, 2015

Hi @vlotech, thank you for reporting the issue.

The problems stem from the fact that both restrict and named struct initialization are C-specific. In order to solve this, the headers must be changed so that they only use constructs available in both C and C++.

@cocreature
Copy link

cocreature commented Apr 15, 2016

Clang and gcc both have a __restrict__ keyword that works for both C and C++, I think msvc calls it __restrict. For now I just changed it to __restrict__ locally and it works just fine using clang.

@PJK
Copy link
Owner

PJK commented Dec 28, 2016

Both of the problems have been fixed through #36

@PJK PJK closed this as completed Dec 28, 2016
PJK added a commit that referenced this issue Jan 6, 2017
PJK added a commit that referenced this issue Jan 10, 2017
PJK added a commit that referenced this issue Jan 11, 2017
PJK added a commit that referenced this issue Sep 30, 2017
PJK added a commit that referenced this issue Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants