Comments (4)
Forgot to add that the command should probably be:
$ cbindgen -v svg2polylines-ffi/ -c cbindgen.toml -o svg2polylines.h
from cbindgen.
What's the reason why it can't be found?
My understanding is that cbindgen
only deals with source code and the AST. So it'll parse your crate and figure out what files it imports, but because it doesn't use the compiler under the hood it can't resolve any imports from outside your crate.
I'm not sure there's an easy fix for this short of hooking into compiler internals (I actually started writing a guide for doing this), which would constrain cbindgen to nightly because compiler internals are always going to be unstable.
from cbindgen.
What's the reason why it can't be found?
The issue here is that you are specifying a specific file, instead of a crate. This causes cbindgen to use single source mode which doesn't parse external crates (because it doesn't have context to know where external crates are). A warning here would probably be a good idea.
My understanding is that cbindgen only deals with source code and the AST. So it'll parse your crate and figure out what files it imports, but because it doesn't use the compiler under the hood it can't resolve any imports from outside your crate.
This is partially true. cbindgen can be configured to emulate cargo and rustc's crate searching behavior, without using compiler internals. This only works with crate parsing mode, which is the bug here.
from cbindgen.
I've added a warning for this in version 0.2.1
. Closing this for now as there is a solution.
from cbindgen.
Related Issues (20)
- error[E0107]: struct takes 3 generic arguments but 2 generic arguments were supplied
- How can i offline install HOT 1
- `parse.expand` should use nightly compiler when available like upstream `cargo-expand` HOT 1
- Generate a unified header file that can be used in both C and C++ HOT 1
- conflicting implementations of trait `std::default::Default` for type `config::Config` HOT 2
- Decoupling this project from Cargo HOT 4
- cbindgen can not find struct from pre-release crates HOT 1
- Support 'pub const BAR: &CStr = c"hello world";' HOT 5
- How to install it or to compile it for win32? HOT 1
- Opaque type for Mutex HOT 3
- Types not exported when using build script but CLI works HOT 2
- rename type by annotation HOT 1
- Modules inside cfg_if! macros aren't read / expanded (was: The C header file cannot be generated correctly.) HOT 2
- Incorrect (outdated?) `fetch_all_dependencies` config suggestion HOT 2
- derive-{eq,neq} doesn't account for #[cfg()]d fields.
- [Feature Request] GObject support HOT 2
- cbindgen emits constants in spite of no-export and/or ignore annotations HOT 6
- WARN: Skip unsupported call expression HOT 1
- Generate C packed struct HOT 2
- `defines` is not applied for impl const HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cbindgen.