Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

cannot find type _CharT in this scope #8

Closed
ctaggart opened this issue Apr 21, 2017 · 6 comments
Closed

cannot find type _CharT in this scope #8

ctaggart opened this issue Apr 21, 2017 · 6 comments

Comments

@ctaggart
Copy link
Owner


   Compiling octh v0.1.0 (file:///C:/Users/CameronTaggart/rs/octh)
error[E0412]: cannot find type `_CharT` in this scope
   --> src\lib.rs:788:77
    |
788 |             root::std::basic_streambuf<root::std::basic_streambuf_char_type<_CharT>>;
    |                                                                             ^^^^^^ not found in this scope

error[E0412]: cannot find type `_Traits` in this scope
   --> src\lib.rs:812:53
    |
812 |         pub type basic_istream_sentry_traits_type = _Traits;
    |                                                     ^^^^^^^ not found in this scope
@mtmiller
Copy link
Collaborator

I know only a little rust, and nothing about bindgen, but I think you want to read this and apply some whitelisting so you are not trying to bind the entire C++ std library.

ctaggart pushed a commit that referenced this issue Apr 21, 2017
got past #8, but ran into #11
@ctaggart
Copy link
Owner Author

ctaggart commented Apr 21, 2017

I tried making several types opaque, but ran into #11.
https://github.com/ctaggart/octh/blob/opaque/build.rs

@ctaggart
Copy link
Owner Author

I think this is coming from random.h or opt_random.h. Those are the only files that have _UIntType.
C:\Octave\Octave-4.2.1\lib\gcc\x86_64-w64-mingw32\4.9.4\include\c++\bits\random.h
Should try disabling it and seeing what happens:

#define _RANDOM_H 1

ctaggart added a commit that referenced this issue May 18, 2017
* try making types opaque
got past #8, but ran into #11

* it compiles

* genereated with latest bindgen
@ctaggart
Copy link
Owner Author

fixed by #22

@ctaggart
Copy link
Owner Author

This is an issue again because of #28.

error[E0412]: cannot find type `_CharT` in this scope
    --> /home/cameron/octh/target/debug/build/octh-0257c31d36ec758f/out/bindings.rs:2278:54
     |
2278 |             pub _M_os: *mut root::std::basic_ostream<_CharT>,
     |                                                      ^^^^^^ not found in this scope

@ctaggart
Copy link
Owner Author

ctaggart commented Oct 1, 2017

template <typename, typename = int> class a;
template <typename _CharT> class b { _CharT c; };
template <typename _CharT, typename> class a : b<_CharT> { class B; };
template <typename _CharT, typename d> class a<_CharT, d>::B {
  a<_CharT, d> e;
};
class octave_diary_stream : a<char> {};
real    228m12,956s
user    367m50,032s
sys     70m32,604s
#!/usr/bin/env bash
set -eu
clang-3.9 --std=c++11 -c __bindgen.ii

~/rust-bindgen/target/release/bindgen \
    --output __bindgen.rs \
    --enable-cxx-namespaces \
    --whitelist-type octave.* \
    --whitelist-function octave.* \
    --use-core \
    --raw-line "extern crate core;" \
    __bindgen.ii \
    -- -v -x c++ -std=c++11 \
    2>/dev/null

rustc __bindgen.rs \
    2>&1 \
    | grep 'error\[E0412\]: cannot find type `_CharT` in this scope'

# time creduce ./bindgen-octh-8.sh __bindgen.ii

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants