Giter Site home page Giter Site logo

svalorzen / cpp-readline Goto Github PK

View Code? Open in Web Editor NEW
58.0 58.0 19.0 30 KB

A very simple C++ wrapper for GNU readline.

License: GNU General Public License v3.0

C++ 79.67% CMake 19.78% Makefile 0.55%
c-plus-plus cpp-readline gnu-readline readline-library

cpp-readline's People

Contributors

dzhioev avatar jktjkt avatar prior99 avatar svalorzen avatar zmij avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cpp-readline's Issues

Build failed due to "use of undeclared identifier" in two places

I was trying to build the example and it failed with the following output:

$make
Scanning dependencies of target cpp-readline
[ 25%] Building CXX object src/CMakeFiles/cpp-readline.dir/Console.cpp.o
.../cpp-readline/src/Console.cpp:100:13: error: 
      use of undeclared identifier 'history_set_history_state'
            history_set_history_state(emptyHistory);
            ^
/Users/its_behind_you/project_job/licpp/cpp-readline/src/Console.cpp:102:13: error: 
      use of undeclared identifier 'history_set_history_state'
            history_set_history_state(pimpl_->history_);
            ^
2 errors generated.
make[2]: *** [src/CMakeFiles/cpp-readline.dir/Console.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/cpp-readline.dir/all] Error 2
make: *** [all] Error 2

Build failure due to std::unordered_map's explicit constructor

Using GCC 4.9.3:

FAILED: /usr/bin/c++   -Dcpp_readline_EXPORTS -g -fPIC -I../src \
-std=c++11 -Wall -Werror -pedantic -Weffc++ -MMD \
-MT src/CMakeFiles/cpp-readline.dir/Console.cpp.o \
-MF src/CMakeFiles/cpp-readline.dir/Console.cpp.o.d \
-o src/CMakeFiles/cpp-readline.dir/Console.cpp.o -c ../src/Console.cpp
../src/Console.cpp:28:44: error: converting to ‘CppReadline::Console::Impl::RegisteredCommands {aka std::unordered_map<std::basic_string<char>, std::function<int(const std::vector<std::basic_string<char> >&)> >}’ from initializer list would use explicit constructor ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type, const hasher&, const key_equal&, const allocator_type&) [with _Key = std::basic_string<char>; _Tp = std::function<int(const std::vector<std::basic_string<char> >&)>; _Hash = std::hash<std::basic_string<char> >; _Pred = std::equal_to<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, std::function<int(const std::vector<std::basic_string<char> >&)> > >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type = long unsigned int; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hasher = std::hash<std::basic_string<char> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_equal = std::equal_to<std::basic_string<char> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::allocator_type = std::allocator<std::pair<const std::basic_string<char>, std::function<int(const std::vector<std::basic_string<char> >&)> > >]’
         RegisteredCommands  commands_   = {};

Using clang 3.7.0:

FAILED: /usr/bin/clang++   -Dcpp_readline_EXPORTS -g -fPIC -I../src  \
-std=c++11 -Wall -Werror -pedantic -Weffc++ -MMD \
-MT src/CMakeFiles/cpp-readline.dir/Console.cpp.o \
-MF src/CMakeFiles/cpp-readline.dir/Console.cpp.o.d \
-o src/CMakeFiles/cpp-readline.dir/Console.cpp.o -c ../src/Console.cpp
../src/Console.cpp:28:43: error: chosen constructor is explicit in copy-initialization
        RegisteredCommands  commands_   = {};
                                          ^~
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4/bits/unordered_map.h:139:7: note: constructor declared here
      unordered_map(size_type __n = 10,
      ^
1 error generated.

Using exceptions instead of return codes

This is just an idea, but wouldn't it be more C++-like to use exceptions instead of return codes? The Console class could handle those exceptions and automatically print the error messages.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.