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

Error importing library #374

Open
Mq-b opened this issue Oct 25, 2024 · 37 comments
Open

Error importing library #374

Mq-b opened this issue Oct 25, 2024 · 37 comments

Comments

@Mq-b
Copy link

Mq-b commented Oct 25, 2024

root@gao-virtual-machine:~/package_test# g++ test.cpp -o example -I/usr/local/include -L/usr/local/lib -lcpp-terminal
test.cpp:1:10: fatal error: cpp-terminal/base.hpp: 没有那个文件或目录
    1 | #include <cpp-terminal/base.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
root@gao-virtual-machine:~/package_test# ls /usr/local/include/cpp-terminal
args.hpp    cursor.hpp     focus.hpp     iostream_initializer.hpp  options.hpp  stream.hpp    terminal_impl.hpp         tty.hpp
buffer.hpp  event.hpp      input.hpp     key.hpp                   prompt.hpp   style.hpp     terminal_initializer.hpp  version.hpp
color.hpp   exception.hpp  iostream.hpp  mouse.hpp  

code:

#include<cpp-terminal/base.hpp>
#include <cpp-terminal/input.hpp>
#include <cpp-terminal/terminal.hpp>
#include <iostream>

int main() {
    Term::Terminal term;

    term.clear_screen();
    std::cout << "Hello, cpp-terminal!" << std::endl;
    std::cout << "Press any key to exit..." << std::endl;

    Term::Key key = Term::read_key();
    if (key == Term::Key::Enter) {
        std::cout << "You pressed Enter!" << std::endl;
    } else {
        std::cout << "Exiting..." << std::endl;
    }

    // 清理并退出
    term.reset();
    return 0;
}

build:

git clone https://github.com/jupyter-xeus/cpp-terminal.git
cd cpp-terminal
mkdir build
cd build
cmake ..
make
make install
root@gao-virtual-machine:~/package_test# git clone https://github.com/jupyter-xeus/cpp-terminal.git
正克隆到 'cpp-terminal'...
remote: Enumerating objects: 4889, done.
remote: Counting objects: 100% (1894/1894), done.
remote: Compressing objects: 100% (694/694), done.
remote: Total 4889 (delta 1506), reused 1310 (delta 1200), pack-reused 2995 (from 1)
接收对象中: 100% (4889/4889), 1.33 MiB | 35.00 KiB/s, 完成.
处理 delta 中: 100% (3320/3320), 完成.
root@gao-virtual-machine:~/package_test# cd cpp-terminal/
root@gao-virtual-machine:~/package_test/cpp-terminal# mkdir build
root@gao-virtual-machine:~/package_test/cpp-terminal# cd build/
root@gao-virtual-machine:~/package_test/cpp-terminal/build# cmake ..
-- The CXX compiler identification is GNU 12.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Warning (dev) at /snap/cmake/1417/share/cmake-3.30/Modules/FetchContent.cmake:1953 (message):
  Calling FetchContent_Populate(doctest) is deprecated, call
  FetchContent_MakeAvailable(doctest) instead.  Policy CMP0169 can be set to
  OLD to allow FetchContent_Populate(doctest) to be called directly for now,
  but the ability to call it with declared details will be removed completely
  in a future version.
Call Stack (most recent call first):
  tests/CMakeLists.txt:11 (FetchContent_Populate)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Deprecation Warning at build/_deps/doctest-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Configuring done (9.4s)
-- Generating done (0.1s)
-- Build files have been written to: /root/package_test/cpp-terminal/build
root@gao-virtual-machine:~/package_test/cpp-terminal/build# make
[  1%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/version.cpp.o
[  2%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/return_code.cpp.o
[  3%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/file_initializer.cpp.o
[  4%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/exception.cpp.o
[  5%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/unicode.cpp.o
[  6%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/conversion.cpp.o
[  7%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/args.cpp.o
[  8%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/terminal_impl.cpp.o
[  9%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/tty.cpp.o
[ 10%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/terminfo.cpp.o
[ 11%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/input.cpp.o
[ 12%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/screen.cpp.o
[ 13%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/cursor.cpp.o
[ 14%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/file.cpp.o
[ 15%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/env.cpp.o
[ 16%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/blocking_queue.cpp.o
[ 17%] Building CXX object cpp-terminal/private/CMakeFiles/cpp-terminal-private.dir/sigwinch.cpp.o
[ 18%] Linking CXX static library libcpp-terminal-private.a
[ 18%] Built target cpp-terminal-private
[ 20%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/terminal_impl.cpp.o
[ 21%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/terminal_initializer.cpp.o
[ 22%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/iostream_initializer.cpp.o
[ 23%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/mouse.cpp.o
[ 24%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/args.cpp.o
[ 25%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/focus.cpp.o
[ 26%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/buffer.cpp.o
[ 27%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/iostream.cpp.o
[ 28%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/stream.cpp.o
[ 29%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/prompt.cpp.o
/root/package_test/cpp-terminal/cpp-terminal/prompt.cpp: In function ‘std::string Term::prompt_multiline(const std::string&, std::vector<std::__cxx11::basic_string<char> >&, std::function<bool(std::__cxx11::basic_string<char>)>&)’:
/root/package_test/cpp-terminal/cpp-terminal/prompt.cpp:263:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
  263 |           if(not_complete) key = Key(static_cast<Term::Key>(Term::MetaKey::Value::Alt + Term::Key::Enter));
      |           ^~
/root/package_test/cpp-terminal/cpp-terminal/prompt.cpp:267:9: note: here
  267 |         case Key::Backspace:
      |         ^~~~
[ 30%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/window.cpp.o
[ 31%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/terminal.cpp.o
[ 32%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/color.cpp.o
[ 33%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/key.cpp.o
[ 34%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/event.cpp.o
[ 35%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/screen.cpp.o
[ 36%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/options.cpp.o
[ 37%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/cursor.cpp.o
[ 38%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/style.cpp.o
[ 40%] Linking CXX static library libcpp-terminal.a
[ 40%] Built target cpp-terminal
[ 41%] Building CXX object tests/CMakeFiles/file.test.dir/file.test.cpp.o
[ 42%] Linking CXX executable file.test
[ 42%] Built target file.test
[ 43%] Building CXX object tests/CMakeFiles/key.test.dir/key.test.cpp.o
[ 44%] Linking CXX executable key.test
[ 44%] Built target key.test
[ 45%] Building CXX object tests/CMakeFiles/screen.test.dir/screen.test.cpp.o
[ 46%] Linking CXX executable screen.test
[ 46%] Built target screen.test
[ 47%] Building CXX object tests/CMakeFiles/events.test.dir/events.test.cpp.o
[ 48%] Linking CXX executable events.test
[ 48%] Built target events.test
[ 49%] Building CXX object tests/CMakeFiles/exception.test.dir/exception.test.cpp.o
[ 50%] Linking CXX executable exception.test
[ 50%] Built target exception.test
[ 51%] Building CXX object tests/CMakeFiles/unicode.test.dir/unicode.test.cpp.o
[ 52%] Linking CXX executable unicode.test
[ 52%] Built target unicode.test
[ 53%] Building CXX object tests/CMakeFiles/options.test.dir/options.test.cpp.o
[ 54%] Linking CXX executable options.test
[ 54%] Built target options.test
[ 55%] Building CXX object tests/CMakeFiles/version.test.dir/version.test.cpp.o
[ 56%] Linking CXX executable version.test
[ 56%] Built target version.test
[ 56%] Building CXX object tests/CMakeFiles/Args.dir/args.test.cpp.o
[ 57%] Linking CXX executable Args
[ 57%] Built target Args
[ 58%] Building CXX object examples/CMakeFiles/args.dir/args.cpp.o
[ 60%] Linking CXX executable args
[ 60%] Built target args
[ 61%] Building CXX object examples/CMakeFiles/cin_cooked.dir/cin_cooked.cpp.o
[ 62%] Linking CXX executable cin_cooked
[ 62%] Built target cin_cooked
[ 63%] Building CXX object examples/CMakeFiles/cin_raw.dir/cin_raw.cpp.o
[ 64%] Linking CXX executable cin_raw
[ 64%] Built target cin_raw
[ 65%] Building CXX object examples/CMakeFiles/colors.dir/colors.cpp.o
[ 66%] Linking CXX executable colors
[ 66%] Built target colors
[ 67%] Building CXX object examples/CMakeFiles/cout.dir/cout.cpp.o
[ 68%] Linking CXX executable cout
[ 68%] Built target cout
[ 69%] Building CXX object examples/CMakeFiles/events.dir/events.cpp.o
[ 70%] Linking CXX executable events
[ 70%] Built target events
[ 71%] Building CXX object examples/CMakeFiles/keys.dir/keys.cpp.o
In file included from /root/package_test/cpp-terminal/cpp-terminal/iostream.hpp:13,
                 from /root/package_test/cpp-terminal/examples/keys.cpp:13:
/root/package_test/cpp-terminal/cpp-terminal/stream.hpp: In member function ‘Term::TOstream& Term::TOstream::operator<<(const T&) [with T = std::__cxx11::basic_string<char>()]’:
/root/package_test/cpp-terminal/cpp-terminal/stream.hpp:52:14: warning: ‘nonnull’ argument ‘t’ compared to NULL [-Wnonnull-compare]
   52 |     m_stream << t;
      |     ~~~~~~~~~^~~~
[ 72%] Linking CXX executable keys
[ 72%] Built target keys
[ 73%] Building CXX object examples/CMakeFiles/kilo.dir/kilo.cpp.o
/root/package_test/cpp-terminal/examples/kilo.cpp: In function ‘void {anonymous}::editorUpdateSyntax(erow*)’:
/root/package_test/cpp-terminal/examples/kilo.cpp:267:30: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  267 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
      |                 ~~~~~~~~~~~~~^~~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp: In function ‘int {anonymous}::editorRowCxToRx(erow*, int)’:
/root/package_test/cpp-terminal/examples/kilo.cpp:311:28: warning: comparison of integer expressions of different signedness: ‘std::size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
  311 |   for(std::size_t j = 0; j < cx; ++j)
      |                          ~~^~~~
/root/package_test/cpp-terminal/examples/kilo.cpp: In function ‘void {anonymous}::editorInsertRow(int, const char*, std::size_t)’:
/root/package_test/cpp-terminal/examples/kilo.cpp:361:19: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  361 |   if(at < 0 || at > E.numrows) return;
      |                ~~~^~~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp:366:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  366 |   for(int j = at + 1; j <= E.numrows; j++) E.row[j].idx++;
      |                       ~~^~~~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp: In function ‘void {anonymous}::editorDelRow(int)’:
/root/package_test/cpp-terminal/examples/kilo.cpp:399:19: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  399 |   if(at < 0 || at >= E.numrows) return;
      |                ~~~^~~~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp:402:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  402 |   for(int j = at; j < E.numrows - 1; j++) E.row[j].idx--;
      |                   ~~^~~~~~~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp: In function ‘void {anonymous}::editorFindCallback(std::string&, const Term::Key&)’:
/root/package_test/cpp-terminal/examples/kilo.cpp:575:20: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  575 |   for(int i = 0; i < E.numrows; i++)
      |                  ~~^~~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp:579:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  579 |     else if(current == E.numrows) { current = 0; }
      |             ~~~~~~~~^~~~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp: In function ‘void {anonymous}::editorScroll()’:
/root/package_test/cpp-terminal/examples/kilo.cpp:627:11: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  627 |   if(E.rx < E.coloff) { E.coloff = E.rx; }
      |      ~~~~~^~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp:628:11: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  628 |   if(E.rx >= E.coloff + E.screencols) { E.coloff = E.rx - E.screencols + 1; }
      |      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp: In function ‘void {anonymous}::editorDrawRows(std::string&)’:
/root/package_test/cpp-terminal/examples/kilo.cpp:633:20: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  633 |   for(int y = 0; y < E.screenrows; y++)
      |                  ~~^~~~~~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp:636:16: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  636 |     if(filerow >= E.numrows)
      |        ~~~~~~~~^~~~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp:638:30: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  638 |       if(E.numrows == 0 && y == E.screenrows / 3)
      |                            ~~^~~~~~~~~~~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp:642:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  642 |         if(welcomelen > E.screencols) welcomelen = E.screencols;
      |            ~~~~~~~~~~~^~~~~~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp:658:14: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  658 |       if(len > E.screencols) len = E.screencols;
      |          ~~~~^~~~~~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp: In function ‘void {anonymous}::editorMoveCursor(const Term::Key&)’:
/root/package_test/cpp-terminal/examples/kilo.cpp:799:22: warning: comparison of integer expressions of different signedness: ‘std::size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
  799 |       if(row && E.cx < row->size) { E.cx++; }
      |                 ~~~~~^~~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp:800:27: warning: comparison of integer expressions of different signedness: ‘std::size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
  800 |       else if(row && E.cx == row->size)
      |                      ~~~~~^~~~~~~~~~~~
/root/package_test/cpp-terminal/examples/kilo.cpp:817:11: warning: comparison of integer expressions of different signedness: ‘std::size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
  817 |   if(E.cx > rowlen) { E.cx = rowlen; }
      |      ~~~~~^~~~~~~~
[ 74%] Linking CXX executable kilo
[ 74%] Built target kilo
[ 75%] Building CXX object examples/CMakeFiles/menu.dir/menu.cpp.o
[ 76%] Linking CXX executable menu
[ 76%] Built target menu
[ 77%] Building CXX object examples/CMakeFiles/menu_window.dir/menu_window.cpp.o
[ 78%] Linking CXX executable menu_window
[ 78%] Built target menu_window
[ 80%] Building CXX object examples/CMakeFiles/minimal.dir/minimal.cpp.o
[ 81%] Linking CXX executable minimal
[ 81%] Built target minimal
[ 82%] Building CXX object examples/CMakeFiles/prompt_immediate.dir/prompt_immediate.cpp.o
[ 83%] Linking CXX executable prompt_immediate
[ 83%] Built target prompt_immediate
[ 84%] Building CXX object examples/CMakeFiles/prompt_multiline.dir/prompt_multiline.cpp.o
[ 85%] Linking CXX executable prompt_multiline
[ 85%] Built target prompt_multiline
[ 86%] Building CXX object examples/CMakeFiles/prompt_not_immediate.dir/prompt_not_immediate.cpp.o
[ 87%] Linking CXX executable prompt_not_immediate
[ 87%] Built target prompt_not_immediate
[ 88%] Building CXX object examples/CMakeFiles/prompt_simple.dir/prompt_simple.cpp.o
[ 89%] Linking CXX executable prompt_simple
[ 89%] Built target prompt_simple
[ 90%] Building CXX object examples/CMakeFiles/styles.dir/styles.cpp.o
[ 91%] Linking CXX executable styles
[ 91%] Built target styles
[ 92%] Building CXX object examples/CMakeFiles/slow_events.dir/slow_events.cpp.o
[ 93%] Linking CXX executable slow_events
[ 93%] Built target slow_events
[ 94%] Building CXX object examples/CMakeFiles/utf8.dir/utf8.cpp.o
[ 95%] Linking CXX executable utf8
[ 95%] Built target utf8
[ 96%] Building CXX object examples/CMakeFiles/attach_console.dir/attach_console.cpp.o
[ 97%] Linking CXX executable attach_console
[ 97%] Built target attach_console
[ 98%] Building CXX object examples/CMakeFiles/attach_console_minimal.dir/attach_console_minimal.cpp.o
[100%] Linking CXX executable attach_console_minimal
[100%] Built target attach_console_minimal
root@gao-virtual-machine:~/package_test/cpp-terminal/build# make install
[ 18%] Built target cpp-terminal-private
[ 40%] Built target cpp-terminal
[ 42%] Built target file.test
[ 44%] Built target key.test
[ 46%] Built target screen.test
[ 48%] Built target events.test
[ 50%] Built target exception.test
[ 52%] Built target unicode.test
[ 54%] Built target options.test
[ 56%] Built target version.test
[ 57%] Built target Args
[ 60%] Built target args
[ 62%] Built target cin_cooked
[ 64%] Built target cin_raw
[ 66%] Built target colors
[ 68%] Built target cout
[ 70%] Built target events
[ 72%] Built target keys
[ 74%] Built target kilo
[ 76%] Built target menu
[ 78%] Built target menu_window
[ 81%] Built target minimal
[ 83%] Built target prompt_immediate
[ 85%] Built target prompt_multiline
[ 87%] Built target prompt_not_immediate
[ 89%] Built target prompt_simple
[ 91%] Built target styles
[ 93%] Built target slow_events
[ 95%] Built target utf8
[ 97%] Built target attach_console
[100%] Built target attach_console_minimal
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/libcpp-terminal.a
-- Installing: /usr/local/include/cpp-terminal/args.hpp
-- Installing: /usr/local/include/cpp-terminal/buffer.hpp
-- Installing: /usr/local/include/cpp-terminal/color.hpp
-- Installing: /usr/local/include/cpp-terminal/cursor.hpp
-- Installing: /usr/local/include/cpp-terminal/event.hpp
-- Installing: /usr/local/include/cpp-terminal/exception.hpp
-- Installing: /usr/local/include/cpp-terminal/focus.hpp
-- Installing: /usr/local/include/cpp-terminal/input.hpp
-- Installing: /usr/local/include/cpp-terminal/iostream_initializer.hpp
-- Installing: /usr/local/include/cpp-terminal/iostream.hpp
-- Installing: /usr/local/include/cpp-terminal/key.hpp
-- Installing: /usr/local/include/cpp-terminal/mouse.hpp
-- Installing: /usr/local/include/cpp-terminal/options.hpp
-- Installing: /usr/local/include/cpp-terminal/prompt.hpp
-- Installing: /usr/local/include/cpp-terminal/screen.hpp
-- Installing: /usr/local/include/cpp-terminal/stream.hpp
-- Installing: /usr/local/include/cpp-terminal/style.hpp
-- Installing: /usr/local/include/cpp-terminal/terminal_impl.hpp
-- Installing: /usr/local/include/cpp-terminal/terminal_initializer.hpp
-- Installing: /usr/local/include/cpp-terminal/terminal.hpp
-- Installing: /usr/local/include/cpp-terminal/terminfo.hpp
-- Installing: /usr/local/include/cpp-terminal/tty.hpp
-- Installing: /usr/local/include/cpp-terminal/version.hpp
-- Installing: /usr/local/include/cpp-terminal/window.hpp
-- Installing: /usr/local/lib/libcpp-terminal-private.a
-- Installing: /usr/local/lib/cmake/cpp-terminal/cpp-terminalTargets.cmake
-- Installing: /usr/local/lib/cmake/cpp-terminal/cpp-terminalTargets-noconfig.cmake
-- Installing: /usr/local/lib/cmake/cpp-terminal/cpp-terminalConfig.cmake
-- Installing: /usr/local/lib/cmake/cpp-terminal/cpp-terminalConfigVersion.cmake
-- Installing: /usr/local/bin/examples/args
-- Installing: /usr/local/bin/examples/cin_cooked
-- Installing: /usr/local/bin/examples/cin_raw
-- Installing: /usr/local/bin/examples/colors
-- Installing: /usr/local/bin/examples/cout
-- Installing: /usr/local/bin/examples/events
-- Installing: /usr/local/bin/examples/keys
-- Installing: /usr/local/bin/examples/kilo
-- Installing: /usr/local/bin/examples/menu
-- Installing: /usr/local/bin/examples/menu_window
-- Installing: /usr/local/bin/examples/minimal
-- Installing: /usr/local/bin/examples/prompt_immediate
-- Installing: /usr/local/bin/examples/prompt_multiline
-- Installing: /usr/local/bin/examples/prompt_not_immediate
-- Installing: /usr/local/bin/examples/prompt_simple
-- Installing: /usr/local/bin/examples/styles
-- Installing: /usr/local/bin/examples/slow_events
-- Installing: /usr/local/bin/examples/utf8
-- Installing: /usr/local/bin/examples/attach_console
-- Installing: /usr/local/bin/examples/attach_console_minimal
@flagarde
Copy link
Collaborator

Hi, Thank for your comment and tests.

I guess the program you show is your own test right?
I think there is no base.hpp in our include files.

The include files the user can includes are the one which are not in the private folder.

@Mq-b
Copy link
Author

Mq-b commented Oct 25, 2024

Thank you for your reply. I'm sorry. I'll test it

@flagarde
Copy link
Collaborator

You can have a look at keys.cpp in the examples folder.

Then I don't think terminal class has a reset function.
Are you using a program coded for an old version of this library? The API has changed a lot and the version 1.0.0 is a bit misleading has the API is not fixed for now

@Mq-b
Copy link
Author

Mq-b commented Oct 25, 2024

Can you give me a correct code example?

@flagarde
Copy link
Collaborator

flagarde commented Oct 25, 2024

Sure, you can find some simple example in the examples folder of the main branch. I think the one closer to your code is the key.cpp one.

You can try to start from it and modify it to your needs

If you want to have Events informations and not only key press please have a look at the events.cpp example.

@flagarde
Copy link
Collaborator

flagarde commented Oct 25, 2024

From your screenshot it seems you have them already compiled so you can event test them directly

/usr/local/bin/examples/events
/usr/local/bin/examples/keys

@Mq-b
Copy link
Author

Mq-b commented Oct 25, 2024

root@Mq-B:~/cpp-terminal/examples# g++ cout.cpp -o cout -L/usr/local/lib -lcpp-terminal
/usr/bin/ld: /usr/local/lib/libcpp-terminal.a(terminal_impl.cpp.o): in function `Term::Terminal::Terminal()':
terminal_impl.cpp:(.text+0x5b): undefined reference to `Term::Private::Sigwinch::blockSigwinch()'
/usr/bin/ld: terminal_impl.cpp:(.text+0x60): undefined reference to `Term::Private::Sigwinch::registerSigwinch()'
/usr/bin/ld: terminal_impl.cpp:(.text+0x65): undefined reference to `Term::Terminal::store_and_restore()'
/usr/bin/ld: terminal_impl.cpp:(.text+0x71): undefined reference to `Term::Terminal::setMode() const'
/usr/bin/ld: terminal_impl.cpp:(.text+0x76): undefined reference to `Term::Terminal::set_unset_utf8()'
/usr/bin/ld: terminal_impl.cpp:(.text+0xa6): undefined reference to `Term::Private::ExceptionHandler(Term::Private::ExceptionDestination const&)'
/usr/bin/ld: /usr/local/lib/libcpp-terminal.a(terminal_impl.cpp.o): in function `Term::Terminal::~Terminal()':
terminal_impl.cpp:(.text+0x147): undefined reference to `Term::Private::out'
/usr/bin/ld: terminal_impl.cpp:(.text+0x21e): undefined reference to `Term::Private::OutputFileHandler::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: terminal_impl.cpp:(.text+0x2d5): undefined reference to `Term::Private::out'
/usr/bin/ld: terminal_impl.cpp:(.text+0x2f3): undefined reference to `Term::Private::OutputFileHandler::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: terminal_impl.cpp:(.text+0x304): undefined reference to `Term::Terminal::set_unset_utf8()'
/usr/bin/ld: terminal_impl.cpp:(.text+0x309): undefined reference to `Term::Terminal::store_and_restore()'
/usr/bin/ld: terminal_impl.cpp:(.text+0x30e): undefined reference to `Term::Terminal::unsetFocusEvents()'
/usr/bin/ld: terminal_impl.cpp:(.text+0x313): undefined reference to `Term::Terminal::unsetMouseEvents()'
/usr/bin/ld: terminal_impl.cpp:(.text+0x426): undefined reference to `Term::Private::ExceptionHandler(Term::Private::ExceptionDestination const&)'
/usr/bin/ld: /usr/local/lib/libcpp-terminal.a(terminal_impl.cpp.o): in function `Term::Terminal::applyOptions() const':
terminal_impl.cpp:(.text+0x4b7): undefined reference to `Term::Private::out'
/usr/bin/ld: terminal_impl.cpp:(.text+0x58e): undefined reference to `Term::Private::OutputFileHandler::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: terminal_impl.cpp:(.text+0x645): undefined reference to `Term::Private::out'
/usr/bin/ld: terminal_impl.cpp:(.text+0x663): undefined reference to `Term::Private::OutputFileHandler::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: terminal_impl.cpp:(.text+0x67e): undefined reference to `Term::Terminal::setMode() const'
/usr/bin/ld: /usr/local/lib/libcpp-terminal.a(terminal_impl.cpp.o): in function `__static_initialization_and_destruction_0(int, int)':
terminal_impl.cpp:(.text+0x7a0): undefined reference to `Term::Private::FileInitializer::FileInitializer()'
/usr/bin/ld: terminal_impl.cpp:(.text+0x7bb): undefined reference to `Term::Private::FileInitializer::~FileInitializer()'
/usr/bin/ld: /usr/local/lib/libcpp-terminal.a(terminal_initializer.cpp.o): in function `Term::TerminalInitializer::TerminalInitializer()':
terminal_initializer.cpp:(.text+0x65): undefined reference to `Term::Private::FileInitializer::FileInitializer()'
/usr/bin/ld: terminal_initializer.cpp:(.text+0x80): undefined reference to `Term::Private::FileInitializer::~FileInitializer()'
/usr/bin/ld: /usr/local/lib/libcpp-terminal.a(iostream_initializer.cpp.o): in function `Term::IOStreamInitializer::IOStreamInitializer()':
iostream_initializer.cpp:(.text+0x202): undefined reference to `Term::is_stdin_a_tty()'
/usr/bin/ld: iostream_initializer.cpp:(.text+0x2f7): undefined reference to `Term::Private::ExceptionHandler(Term::Private::ExceptionDestination const&)'
/usr/bin/ld: /usr/local/lib/libcpp-terminal.a(buffer.cpp.o): in function `Term::Buffer::sync()':
buffer.cpp:(.text+0x103): undefined reference to `Term::Private::out'
/usr/bin/ld: buffer.cpp:(.text+0x119): undefined reference to `Term::Private::OutputFileHandler::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: /usr/local/lib/libcpp-terminal.a(buffer.cpp.o): in function `Term::Buffer::underflow()':
buffer.cpp:(.text+0x323): undefined reference to `Term::Private::in'
/usr/bin/ld: buffer.cpp:(.text+0x335): undefined reference to `Term::Private::InputFileHandler::read[abi:cxx11]() const'
/usr/bin/ld: buffer.cpp:(.text+0x397): undefined reference to `Term::Private::out'
/usr/bin/ld: buffer.cpp:(.text+0x3d5): undefined reference to `Term::Private::OutputFileHandler::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: buffer.cpp:(.text+0x538): undefined reference to `Term::Private::out'
/usr/bin/ld: buffer.cpp:(.text+0x54a): undefined reference to `Term::Private::OutputFileHandler::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: buffer.cpp:(.text+0x5c4): undefined reference to `Term::Private::out'
/usr/bin/ld: buffer.cpp:(.text+0x5e0): undefined reference to `Term::Private::OutputFileHandler::write(char const&) const'
/usr/bin/ld: buffer.cpp:(.text+0x5e9): undefined reference to `Term::Private::in'
/usr/bin/ld: buffer.cpp:(.text+0x5fb): undefined reference to `Term::Private::InputFileHandler::read[abi:cxx11]() const'
/usr/bin/ld: /usr/local/lib/libcpp-terminal.a(buffer.cpp.o): in function `Term::Buffer::overflow(int)':
buffer.cpp:(.text+0x7e0): undefined reference to `Term::Private::out'
/usr/bin/ld: buffer.cpp:(.text+0x805): undefined reference to `Term::Private::OutputFileHandler::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: buffer.cpp:(.text+0x85e): undefined reference to `Term::Private::out'
/usr/bin/ld: buffer.cpp:(.text+0x874): undefined reference to `Term::Private::OutputFileHandler::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: buffer.cpp:(.text+0x8bd): undefined reference to `Term::Private::out'
/usr/bin/ld: buffer.cpp:(.text+0x8d3): undefined reference to `Term::Private::OutputFileHandler::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: /usr/local/lib/libcpp-terminal.a(buffer.cpp.o): in function `__static_initialization_and_destruction_0(int, int)':
buffer.cpp:(.text+0xa32): undefined reference to `Term::Private::FileInitializer::FileInitializer()'
/usr/bin/ld: buffer.cpp:(.text+0xa4d): undefined reference to `Term::Private::FileInitializer::~FileInitializer()'
collect2: error: ld returned 1 exit status

@Mq-b
Copy link
Author

Mq-b commented Oct 25, 2024

root@Mq-B:~/cpp-terminal/examples# ls /usr/local/include/cpp-terminal
args.hpp    event.hpp      iostream.hpp              options.hpp  style.hpp                 terminfo.hpp
buffer.hpp  exception.hpp  iostream_initializer.hpp  prompt.hpp   terminal.hpp              tty.hpp
color.hpp   focus.hpp      key.hpp                   screen.hpp   terminal_impl.hpp         version.hpp
cursor.hpp  input.hpp      mouse.hpp                 stream.hpp   terminal_initializer.hpp  window.hpp
root@Mq-B:~/cpp-terminal/examples# find /usr/local -name "libcpp-terminal.*"
/usr/local/lib/libcpp-terminal.a
root@Mq-B:~/cpp-terminal/examples# 

@flagarde
Copy link
Collaborator

You don't need to compile the examples by yourself. Cmake has already compiled them and insalled them.

If you want to use this library I recommend you to use CMake.

@Mq-b
Copy link
Author

Mq-b commented Oct 25, 2024

I just wanted to do a quick test

@flagarde
Copy link
Collaborator

flagarde commented Oct 25, 2024

'''cmake

cmake_minimum_required(VERSION 3.10 FATAL_ERROR)

project(test-standalone CXX)

find_package(cpp-terminal REQUIRED)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

add_executable(MyWonderfulProgram Mypath/MyWonderfulProgram.cpp)
target_link_libraries(MyWonderfulProgram PRIVATE cpp-terminal::cpp-terminal)
'''
This should work

@Mq-b
Copy link
Author

Mq-b commented Oct 25, 2024

root@Mq-B:~/cpp-terminal/examples# cmake --build .
[  2%] Building CXX object CMakeFiles/args.dir/args.o
[  5%] Linking CXX executable args
/usr/bin/ld: 找不到 -lcpp-terminal::cpp-terminal: 没有那个文件或目录
/usr/bin/ld: 找不到 -lWarnings::Warnings: 没有那个文件或目录
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/args.dir/build.make:97:args] 错误 1
gmake[1]: *** [CMakeFiles/Makefile2:121:CMakeFiles/args.dir/all] 错误 2
gmake: *** [Makefile:91:all] 错误 2
root@Mq-B:~/cpp-terminal/examples# 

@Mq-b
Copy link
Author

Mq-b commented Oct 25, 2024

I completely understand that in fact, I have been writing less than a link input, so that I can:

cmake_minimum_required(VERSION 3.10 FATAL_ERROR)

project(test-standalone CXX)

add_executable(test-standalone test.cpp)
target_link_libraries(test-standalone -lcpp-terminal -lcpp-terminal-private)
root@Mq-B:~/test# cmake .
-- Configuring done
-- Generating done
-- Build files have been written to: /root/test
root@Mq-B:~/test# make
Consolidate compiler generated dependencies of target test-standalone
[ 50%] Linking CXX executable test-standalone
[100%] Built target test-standalon

@Mq-b
Copy link
Author

Mq-b commented Oct 27, 2024

Under Ubuntu I can introduce it by using the following CMake:

cmake_minimum_required(VERSION 3.10)
project(test_project)

find_package(cpp-terminal REQUIRED)
find_package(Threads REQUIRED)

add_executable(test-standalone test.cpp)
target_link_libraries(test-standalone PRIVATE cpp-terminal::cpp-terminal Threads::Threads)

On the other hand, in windows, it does not, it says the error can not be found:

include("${CMAKE_CURRENT_LIST_DIR}/cpp-terminalTargets.cmake")

cmake:

set(cpp-terminal_DIR "D:/project/cpp-terminal/build/cmake")
find_package(cpp-terminal REQUIRED)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE cpp-terminal::cpp-terminal Threads::Threads)

@Mq-b
Copy link
Author

Mq-b commented Oct 27, 2024

root@Mq-B:/usr/local/lib/cmake/cpp-terminal# ls
cpp-terminalConfig.cmake         cpp-terminalTargets.cmake
cpp-terminalConfigVersion.cmake  cpp-terminalTargets-noconfig.cmake
PS D:\project\cpp-terminal\build\cmake> ls


    Directory: D:\project\cpp-terminal\build\cmake


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        2024/10/26     22:37           1019 cpp-terminalConfig.cmake

@Mq-b
Copy link
Author

Mq-b commented Oct 27, 2024

I recompiled the build and found that there was still only one cmake file in the directory.

git clone https://github.com/jupyter-xeus/cpp-terminal.git
cd D:\project\test_cmake
mkdir build
cd .\build\
cmake ..
cdcmake --build .
PS D:\project\test_cmake\cpp-terminal\build> cd .\cmake\
PS D:\project\test_cmake\cpp-terminal\build\cmake> ls


    Directory: D:\project\test_cmake\cpp-terminal\build\cmake


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        2024/10/27      9:36           1019 cpp-terminalConfig.cmake

@Mq-b
Copy link
Author

Mq-b commented Oct 27, 2024

I think our project may need a detailed build document, not only windows system has problems, even Linux system, I can not follow the CMake you give directly use, it also relies on Threads::Threads.

@flagarde
Copy link
Collaborator

Hi, yes I think the Config file has some problem. An other problem is appearing when the cpp-terminal is compiled as static library

@Mq-b
Copy link
Author

Mq-b commented Oct 29, 2024

After you update you can let me know, I will be happy to test.

@flagarde
Copy link
Collaborator

@Mq-b Hi, I pushed some fixes can you have a try ?

cmake_minimum_required(VERSION 3.10)
project(test_project)

find_package(cpp-terminal REQUIRED)
find_package(Threads REQUIRED)

add_executable(test-standalone test.cpp)
target_link_libraries(test-standalone PRIVATE cpp-terminal::cpp-terminal Threads::Threads)

This should be fixed on Unix for windows I need to do more tests.

@Mq-b
Copy link
Author

Mq-b commented Oct 30, 2024

I sent this paragraph before, and it needs to be linked to find Threads library before it can be used normally.

I don't really know what it is. Is it dependency? Or a sub-project?

This section of CMake I in my Ubuntu test is obviously OK, but windows is not, before the error also sent.

@Mq-b
Copy link
Author

Mq-b commented Oct 30, 2024

29a3a79

I see you have a new submission, I have to go to work now, I will test it today when I have time.

@flagarde
Copy link
Collaborator

@Mq-b Threads is the library that is used by gcc to implement stufs.

@Mq-b
Copy link
Author

Mq-b commented Oct 31, 2024

Similar to -lpthread?

@flagarde
Copy link
Collaborator

@Mq-b Yes exactly but in some system there is not such library or the name is different

@Mq-b
Copy link
Author

Mq-b commented Oct 31, 2024

The problem is, aren't you still relying on the GNU Toolchain? If it's windows, how about using the VC toolchain?

Your README also mentions that the library is cross-platform and supports Linux, windows, and macOS.
How could the CMakeList imported to the library be written this way?

@Mq-b
Copy link
Author

Mq-b commented Oct 31, 2024

@Mq-b Hi, I pushed some fixes can you have a try ?

cmake_minimum_required(VERSION 3.10)
project(test_project)

find_package(cpp-terminal REQUIRED)
find_package(Threads REQUIRED)

add_executable(test-standalone test.cpp)
target_link_libraries(test-standalone PRIVATE cpp-terminal::cpp-terminal Threads::Threads)

This should be fixed on Unix for windows I need to do more tests.

Okay, I will. I didn't notice you were emphasizing Unix. Sorry.

@Mq-b
Copy link
Author

Mq-b commented Oct 31, 2024

root@Mq-B:~# git clone https://github.com/jupyter-xeus/cpp-terminal.git
正克隆到 'cpp-terminal'...
remote: Enumerating objects: 4986, done.
remote: Counting objects: 100% (1947/1947), done.
remote: Compressing objects: 100% (756/756), done.
remote: Total 4986 (delta 1529), reused 1323 (delta 1191), pack-reused 3039 (from 1)
接收对象中: 100% (4986/4986), 1.36 MiB | 177.00 KiB/s, 完成.
处理 delta 中: 100% (3383/3383), 完成.
root@Mq-B:~# cd cpp-terminal/
root@Mq-B:~/cpp-terminal# mkdir build
root@Mq-B:~/cpp-terminal# cd build/
root@Mq-B:~/cpp-terminal/build# cmake ..
-- The CXX compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /root/cpp-terminal/build
root@Mq-B:~/cpp-terminal/build# cmake --build .
[  1%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/terminal_impl.cpp.o
[  2%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/terminal_initializer.cpp.o
[  3%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/iostream_initializer.cpp.o
[  4%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/mouse.cpp.o
[  5%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/args.cpp.o
[  6%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/focus.cpp.o
[  7%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/buffer.cpp.o
[  8%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/iostream.cpp.o
[  9%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/stream.cpp.o
[ 10%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/prompt.cpp.o
/root/cpp-terminal/cpp-terminal/prompt.cpp: In function ‘std::string Term::prompt_multiline(const string&, std::vector<std::__cxx11::basic_string<char> >&, std::function<bool(std::__cxx11::basic_string<char>)>&)’:
/root/cpp-terminal/cpp-terminal/prompt.cpp:263:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
  263 |           if(not_complete) key = Key(static_cast<Term::Key>(Term::MetaKey::Value::Alt + Term::Key::Enter));
      |           ^~
/root/cpp-terminal/cpp-terminal/prompt.cpp:267:9: note: here
  267 |         case Key::Backspace:
      |         ^~~~
[ 11%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/window.cpp.o
[ 12%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/terminal.cpp.o
[ 13%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/color.cpp.o
[ 14%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/key.cpp.o
[ 15%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/event.cpp.o
[ 16%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/screen.cpp.o
[ 17%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/options.cpp.o
[ 18%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/cursor.cpp.o
[ 20%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/style.cpp.o
[ 21%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/version.cpp.o
[ 22%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/return_code.cpp.o
[ 23%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/file_initializer.cpp.o
[ 24%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/exception.cpp.o
[ 25%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/unicode.cpp.o
[ 26%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/conversion.cpp.o
[ 27%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/args.cpp.o
[ 28%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/terminal_impl.cpp.o
[ 29%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/tty.cpp.o
[ 30%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/terminfo.cpp.o
[ 31%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/input.cpp.o
[ 32%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/screen.cpp.o
[ 33%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/cursor.cpp.o
[ 34%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/file.cpp.o
[ 35%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/env.cpp.o
[ 36%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/blocking_queue.cpp.o
[ 37%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/sigwinch.cpp.o
[ 38%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/private/signals.cpp.o
/root/cpp-terminal/cpp-terminal/private/signals.cpp: In member function ‘void Term::Private::Signals::setHandler(void (* const&)(int))’:
/root/cpp-terminal/cpp-terminal/private/signals.cpp:25:84: warning: unused variable ‘hand’ [-Wunused-variable]
   25 |   for(std::size_t signal = 0; signal != m_signals_number; ++signal) { sighandler_t hand = std::signal(signal, handler); }
      |                                                                                    ^~~~
/root/cpp-terminal/cpp-terminal/private/signals.cpp: In static member function ‘static void Term::Private::Signals::reset_and_raise(int, std::vector<void (*)(int)>&, Term::Terminal&)’:
/root/cpp-terminal/cpp-terminal/private/signals.cpp:154:18: warning: variable ‘old’ set but not used [-Wunused-but-set-variable]
  154 |     sighandler_t old = std::signal(sign, m_han[sign]);
      |                  ^~~
[ 40%] Linking CXX shared library libcpp-terminal.so
[ 40%] Built target cpp-terminal
[ 41%] Building CXX object tests/CMakeFiles/file.test.dir/file.test.cpp.o
[ 42%] Linking CXX executable file.test
[ 42%] Built target file.test
[ 43%] Building CXX object tests/CMakeFiles/key.test.dir/key.test.cpp.o
[ 44%] Linking CXX executable key.test
[ 44%] Built target key.test
[ 45%] Building CXX object tests/CMakeFiles/screen.test.dir/screen.test.cpp.o
[ 46%] Linking CXX executable screen.test
[ 46%] Built target screen.test
[ 47%] Building CXX object tests/CMakeFiles/events.test.dir/events.test.cpp.o
[ 48%] Linking CXX executable events.test
[ 48%] Built target events.test
[ 49%] Building CXX object tests/CMakeFiles/exception.test.dir/exception.test.cpp.o
[ 50%] Linking CXX executable exception.test
[ 50%] Built target exception.test
[ 51%] Building CXX object tests/CMakeFiles/unicode.test.dir/unicode.test.cpp.o
[ 52%] Linking CXX executable unicode.test
[ 52%] Built target unicode.test
[ 53%] Building CXX object tests/CMakeFiles/options.test.dir/options.test.cpp.o
[ 54%] Linking CXX executable options.test
[ 54%] Built target options.test
[ 55%] Building CXX object tests/CMakeFiles/version.test.dir/version.test.cpp.o
[ 56%] Linking CXX executable version.test
[ 56%] Built target version.test
[ 56%] Building CXX object tests/CMakeFiles/Args.dir/args.test.cpp.o
[ 57%] Linking CXX executable Args
[ 57%] Built target Args
[ 58%] Building CXX object examples/CMakeFiles/args.dir/args.cpp.o
[ 60%] Linking CXX executable args
[ 60%] Built target args
[ 61%] Building CXX object examples/CMakeFiles/cin_cooked.dir/cin_cooked.cpp.o
[ 62%] Linking CXX executable cin_cooked
[ 62%] Built target cin_cooked
[ 63%] Building CXX object examples/CMakeFiles/cin_raw.dir/cin_raw.cpp.o
[ 64%] Linking CXX executable cin_raw
[ 64%] Built target cin_raw
[ 65%] Building CXX object examples/CMakeFiles/colors.dir/colors.cpp.o
[ 66%] Linking CXX executable colors
[ 66%] Built target colors
[ 67%] Building CXX object examples/CMakeFiles/cout.dir/cout.cpp.o
[ 68%] Linking CXX executable cout
[ 68%] Built target cout
[ 69%] Building CXX object examples/CMakeFiles/events.dir/events.cpp.o
[ 70%] Linking CXX executable events
[ 70%] Built target events
[ 71%] Building CXX object examples/CMakeFiles/keys.dir/keys.cpp.o
In file included from /root/cpp-terminal/cpp-terminal/iostream.hpp:13,
                 from /root/cpp-terminal/examples/keys.cpp:13:
/root/cpp-terminal/cpp-terminal/stream.hpp: In instantiation of âTerm::TOstream& Term::TOstream::operator<<(const T&) [with T = std::__cxx11::basic_string<char>()]â:
/root/cpp-terminal/examples/keys.cpp:55:84:   required from here
/root/cpp-terminal/cpp-terminal/stream.hpp:52:14: warning: the compiler can assume that the address of âtâ will never be NULL [-Waddress]
   52 |     m_stream << t;
      |     ~~~~~~~~~^~~~
/root/cpp-terminal/cpp-terminal/stream.hpp: In member function âTerm::TOstream& Term::TOstream::operator<<(const T&) [with T = std::__cxx11::basic_string<char>()]â:
/root/cpp-terminal/cpp-terminal/stream.hpp:52:14: warning: ânonnullâ argument âtâ compared to NULL [-Wnonnull-compare]
   52 |     m_stream << t;
      |     ~~~~~~~~~^~~~
[ 72%] Linking CXX executable keys
[ 72%] Built target keys
[ 73%] Building CXX object examples/CMakeFiles/kilo.dir/kilo.cpp.o
/root/cpp-terminal/examples/kilo.cpp: In function âvoid {anonymous}::editorUpdateSyntax({anonymous}::erow*)â:
/root/cpp-terminal/examples/kilo.cpp:267:30: warning: comparison of integer expressions of different signedness: âintâ and âstd::size_tâ {aka âlong unsigned intâ} [-Wsign-compare]
  267 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
      |                 ~~~~~~~~~~~~~^~~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp: In function âint {anonymous}::editorRowCxToRx({anonymous}::erow*, int)â:
/root/cpp-terminal/examples/kilo.cpp:311:28: warning: comparison of integer expressions of different signedness: âstd::size_tâ {aka âlong unsigned intâ} and âintâ [-Wsign-compare]
  311 |   for(std::size_t j = 0; j < cx; ++j)
      |                          ~~^~~~
/root/cpp-terminal/examples/kilo.cpp: In function âvoid {anonymous}::editorInsertRow(int, const char*, std::size_t)â:
/root/cpp-terminal/examples/kilo.cpp:361:19: warning: comparison of integer expressions of different signedness: âintâ and âstd::size_tâ {aka âlong unsigned intâ} [-Wsign-compare]
  361 |   if(at < 0 || at > E.numrows) return;
      |                ~~~^~~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp:366:25: warning: comparison of integer expressions of different signedness: âintâ and âstd::size_tâ {aka âlong unsigned intâ} [-Wsign-compare]
  366 |   for(int j = at + 1; j <= E.numrows; j++) E.row[j].idx++;
      |                       ~~^~~~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp: In function âvoid {anonymous}::editorDelRow(int)â:
/root/cpp-terminal/examples/kilo.cpp:399:19: warning: comparison of integer expressions of different signedness: âintâ and âstd::size_tâ {aka âlong unsigned intâ} [-Wsign-compare]
  399 |   if(at < 0 || at >= E.numrows) return;
      |                ~~~^~~~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp:402:21: warning: comparison of integer expressions of different signedness: âintâ and âstd::size_tâ {aka âlong unsigned intâ} [-Wsign-compare]
  402 |   for(int j = at; j < E.numrows - 1; j++) E.row[j].idx--;
      |                   ~~^~~~~~~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp: In function âvoid {anonymous}::editorFindCallback(std::string&, const Term::Key&)â:
/root/cpp-terminal/examples/kilo.cpp:575:20: warning: comparison of integer expressions of different signedness: âintâ and âstd::size_tâ {aka âlong unsigned intâ} [-Wsign-compare]
  575 |   for(int i = 0; i < E.numrows; i++)
      |                  ~~^~~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp:579:21: warning: comparison of integer expressions of different signedness: âintâ and âstd::size_tâ {aka âlong unsigned intâ} [-Wsign-compare]
  579 |     else if(current == E.numrows) { current = 0; }
      |             ~~~~~~~~^~~~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp: In function âvoid {anonymous}::editorScroll()â:
/root/cpp-terminal/examples/kilo.cpp:627:11: warning: comparison of integer expressions of different signedness: âintâ and âstd::size_tâ {aka âlong unsigned intâ} [-Wsign-compare]
  627 |   if(E.rx < E.coloff) { E.coloff = E.rx; }
      |      ~~~~~^~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp:628:11: warning: comparison of integer expressions of different signedness: âintâ and âstd::size_tâ {aka âlong unsigned intâ} [-Wsign-compare]
  628 |   if(E.rx >= E.coloff + E.screencols) { E.coloff = E.rx - E.screencols + 1; }
      |      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp: In function âvoid {anonymous}::editorDrawRows(std::string&)â:
/root/cpp-terminal/examples/kilo.cpp:633:20: warning: comparison of integer expressions of different signedness: âintâ and âstd::size_tâ {aka âlong unsigned intâ} [-Wsign-compare]
  633 |   for(int y = 0; y < E.screenrows; y++)
      |                  ~~^~~~~~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp:636:16: warning: comparison of integer expressions of different signedness: âintâ and âstd::size_tâ {aka âlong unsigned intâ} [-Wsign-compare]
  636 |     if(filerow >= E.numrows)
      |        ~~~~~~~~^~~~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp:638:30: warning: comparison of integer expressions of different signedness: âintâ and âstd::size_tâ {aka âlong unsigned intâ} [-Wsign-compare]
  638 |       if(E.numrows == 0 && y == E.screenrows / 3)
      |                            ~~^~~~~~~~~~~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp:642:23: warning: comparison of integer expressions of different signedness: âintâ and âstd::size_tâ {aka âlong unsigned intâ} [-Wsign-compare]
  642 |         if(welcomelen > E.screencols) welcomelen = E.screencols;
      |            ~~~~~~~~~~~^~~~~~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp:658:14: warning: comparison of integer expressions of different signedness: âintâ and âstd::size_tâ {aka âlong unsigned intâ} [-Wsign-compare]
  658 |       if(len > E.screencols) len = E.screencols;
      |          ~~~~^~~~~~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp: In function âvoid {anonymous}::editorMoveCursor(const Term::Key&)â:
/root/cpp-terminal/examples/kilo.cpp:799:22: warning: comparison of integer expressions of different signedness: âstd::size_tâ {aka âlong unsigned intâ} and âintâ [-Wsign-compare]
  799 |       if(row && E.cx < row->size) { E.cx++; }
      |                 ~~~~~^~~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp:800:27: warning: comparison of integer expressions of different signedness: âstd::size_tâ {aka âlong unsigned intâ} and âintâ [-Wsign-compare]
  800 |       else if(row && E.cx == row->size)
      |                      ~~~~~^~~~~~~~~~~~
/root/cpp-terminal/examples/kilo.cpp:817:11: warning: comparison of integer expressions of different signedness: âstd::size_tâ {aka âlong unsigned intâ} and âintâ [-Wsign-compare]
  817 |   if(E.cx > rowlen) { E.cx = rowlen; }
      |      ~~~~~^~~~~~~~
[ 74%] Linking CXX executable kilo
[ 74%] Built target kilo
[ 75%] Building CXX object examples/CMakeFiles/menu.dir/menu.cpp.o
[ 76%] Linking CXX executable menu
[ 76%] Built target menu
[ 77%] Building CXX object examples/CMakeFiles/menu_window.dir/menu_window.cpp.o
[ 78%] Linking CXX executable menu_window
[ 78%] Built target menu_window
[ 80%] Building CXX object examples/CMakeFiles/minimal.dir/minimal.cpp.o
[ 81%] Linking CXX executable minimal
[ 81%] Built target minimal
[ 82%] Building CXX object examples/CMakeFiles/prompt_immediate.dir/prompt_immediate.cpp.o
[ 83%] Linking CXX executable prompt_immediate
[ 83%] Built target prompt_immediate
[ 84%] Building CXX object examples/CMakeFiles/prompt_multiline.dir/prompt_multiline.cpp.o
[ 85%] Linking CXX executable prompt_multiline
[ 85%] Built target prompt_multiline
[ 86%] Building CXX object examples/CMakeFiles/prompt_not_immediate.dir/prompt_not_immediate.cpp.o
[ 87%] Linking CXX executable prompt_not_immediate
[ 87%] Built target prompt_not_immediate
[ 88%] Building CXX object examples/CMakeFiles/prompt_simple.dir/prompt_simple.cpp.o
[ 89%] Linking CXX executable prompt_simple
[ 89%] Built target prompt_simple
[ 90%] Building CXX object examples/CMakeFiles/styles.dir/styles.cpp.o
[ 91%] Linking CXX executable styles
[ 91%] Built target styles
[ 92%] Building CXX object examples/CMakeFiles/utf8.dir/utf8.cpp.o
[ 93%] Linking CXX executable utf8
[ 93%] Built target utf8
[ 94%] Building CXX object examples/CMakeFiles/signal.dir/signal.cpp.o
/root/cpp-terminal/examples/signal.cpp: In lambda function:
/root/cpp-terminal/examples/signal.cpp:23:22: warning: unused parameter âsigâ [-Wunused-parameter]
   23 |               [](int sig)
      |                  ~~~~^~~
[ 95%] Linking CXX executable signal
[ 95%] Built target signal
[ 96%] Building CXX object examples/CMakeFiles/attach_console.dir/attach_console.cpp.o
[ 97%] Linking CXX executable attach_console
[ 97%] Built target attach_console
[ 98%] Building CXX object examples/CMakeFiles/attach_console_minimal.dir/attach_console_minimal.cpp.o
[100%] Linking CXX executable attach_console_minimal
[100%] Built target attach_console_minimal
root@Mq-B:~/cpp-terminal/build# cmake --install .
-- Install configuration: ""
-- Installing: /usr/local/include/doctest/doctest.h
-- Installing: /usr/local/include/doctest/extensions
-- Installing: /usr/local/include/doctest/extensions/mpi_sub_comm.h
-- Installing: /usr/local/include/doctest/extensions/doctest_util.h
-- Installing: /usr/local/include/doctest/extensions/mpi_reporter.h
-- Installing: /usr/local/include/doctest/extensions/doctest_mpi.h
-- Installing: /usr/local/lib/cmake/doctest/doctestConfig.cmake
-- Installing: /usr/local/lib/cmake/doctest/doctestConfigVersion.cmake
-- Installing: /usr/local/lib/cmake/doctest/doctest.cmake
-- Installing: /usr/local/lib/cmake/doctest/doctestAddTests.cmake
-- Installing: /usr/local/lib/cmake/doctest/doctestTargets.cmake
-- Installing: /usr/local/lib/libcpp-terminal.so
-- Installing: /usr/local/include/cpp-terminal/args.hpp
-- Installing: /usr/local/include/cpp-terminal/buffer.hpp
-- Installing: /usr/local/include/cpp-terminal/color.hpp
-- Installing: /usr/local/include/cpp-terminal/cursor.hpp
-- Installing: /usr/local/include/cpp-terminal/event.hpp
-- Installing: /usr/local/include/cpp-terminal/exception.hpp
-- Installing: /usr/local/include/cpp-terminal/focus.hpp
-- Installing: /usr/local/include/cpp-terminal/input.hpp
-- Installing: /usr/local/include/cpp-terminal/iostream_initializer.hpp
-- Installing: /usr/local/include/cpp-terminal/iostream.hpp
-- Installing: /usr/local/include/cpp-terminal/key.hpp
-- Installing: /usr/local/include/cpp-terminal/mouse.hpp
-- Installing: /usr/local/include/cpp-terminal/options.hpp
-- Installing: /usr/local/include/cpp-terminal/prompt.hpp
-- Installing: /usr/local/include/cpp-terminal/screen.hpp
-- Installing: /usr/local/include/cpp-terminal/stream.hpp
-- Installing: /usr/local/include/cpp-terminal/style.hpp
-- Installing: /usr/local/include/cpp-terminal/terminal_impl.hpp
-- Installing: /usr/local/include/cpp-terminal/terminal_initializer.hpp
-- Installing: /usr/local/include/cpp-terminal/terminal.hpp
-- Installing: /usr/local/include/cpp-terminal/terminfo.hpp
-- Installing: /usr/local/include/cpp-terminal/tty.hpp
-- Installing: /usr/local/include/cpp-terminal/version.hpp
-- Installing: /usr/local/include/cpp-terminal/window.hpp
-- Old export file "/usr/local/lib/cmake/cpp-terminal/cpp-terminalTargets.cmake" will be replaced.  Removing files [/usr/local/lib/cmake/cpp-terminal/cpp-terminalTargets-noconfig.cmake].
-- Installing: /usr/local/lib/cmake/cpp-terminal/cpp-terminalTargets.cmake
-- Installing: /usr/local/lib/cmake/cpp-terminal/cpp-terminalTargets-noconfig.cmake
-- Installing: /usr/local/lib/cmake/cpp-terminal/cpp-terminalConfig.cmake
-- Installing: /usr/local/lib/cmake/cpp-terminal/cpp-terminalConfigVersion.cmake
-- Installing: /usr/local/bin/examples/args
-- Set runtime path of "/usr/local/bin/examples/args" to ""
-- Installing: /usr/local/bin/examples/cin_cooked
-- Set runtime path of "/usr/local/bin/examples/cin_cooked" to ""
-- Installing: /usr/local/bin/examples/cin_raw
-- Set runtime path of "/usr/local/bin/examples/cin_raw" to ""
-- Installing: /usr/local/bin/examples/colors
-- Set runtime path of "/usr/local/bin/examples/colors" to ""
-- Installing: /usr/local/bin/examples/cout
-- Set runtime path of "/usr/local/bin/examples/cout" to ""
-- Installing: /usr/local/bin/examples/events
-- Set runtime path of "/usr/local/bin/examples/events" to ""
-- Installing: /usr/local/bin/examples/keys
-- Set runtime path of "/usr/local/bin/examples/keys" to ""
-- Installing: /usr/local/bin/examples/kilo
-- Set runtime path of "/usr/local/bin/examples/kilo" to ""
-- Installing: /usr/local/bin/examples/menu
-- Set runtime path of "/usr/local/bin/examples/menu" to ""
-- Installing: /usr/local/bin/examples/menu_window
-- Set runtime path of "/usr/local/bin/examples/menu_window" to ""
-- Installing: /usr/local/bin/examples/minimal
-- Set runtime path of "/usr/local/bin/examples/minimal" to ""
-- Installing: /usr/local/bin/examples/prompt_immediate
-- Set runtime path of "/usr/local/bin/examples/prompt_immediate" to ""
-- Installing: /usr/local/bin/examples/prompt_multiline
-- Set runtime path of "/usr/local/bin/examples/prompt_multiline" to ""
-- Installing: /usr/local/bin/examples/prompt_not_immediate
-- Set runtime path of "/usr/local/bin/examples/prompt_not_immediate" to ""
-- Installing: /usr/local/bin/examples/prompt_simple
-- Set runtime path of "/usr/local/bin/examples/prompt_simple" to ""
-- Installing: /usr/local/bin/examples/styles
-- Set runtime path of "/usr/local/bin/examples/styles" to ""
-- Installing: /usr/local/bin/examples/utf8
-- Set runtime path of "/usr/local/bin/examples/utf8" to ""
-- Installing: /usr/local/bin/examples/signal
-- Set runtime path of "/usr/local/bin/examples/signal" to ""
-- Installing: /usr/local/bin/examples/attach_console
-- Set runtime path of "/usr/local/bin/examples/attach_console" to ""
-- Installing: /usr/local/bin/examples/attach_console_minimal
-- Set runtime path of "/usr/local/bin/examples/attach_console_minimal" to ""

@Mq-b
Copy link
Author

Mq-b commented Oct 31, 2024

root@Mq-B:~/test# cmake .
-- Configuring done
-- Generating done
-- Build files have been written to: /root/test
root@Mq-B:~/test# cmake --build .
Consolidate compiler generated dependencies of target test-standalone
[ 50%] Building CXX object CMakeFiles/test-standalone.dir/test.cpp.o
[100%] Linking CXX executable test-standalone
[100%] Built target test-standalone
root@Mq-B:~/test# ./test-standalone 
Normal Text Bold
Normal Text Dim
Normal Text Italic
Normal Text Underline
Normal Text Blink
Normal Text Blink Rapid
Normal Text Reversed
Normal Text Conceal
Normal Text Crossed
Normal Text Font 0
Normal Text Font 1
Normal Text Font 2
Normal Text Font 3
Normal Text Font 4
Normal Text Font 5
Normal Text Font 6
Normal Text Font 7
Normal Text Font 8
Normal Text Font 9
Normal Text Font 10
Normal Text colored back to default
Normal Text colored back to default
Normal Text Frame
Normal Text Encircle
Normal Text Overline
Normal Text Bar right
Normal Text Double bar right
Normal Text Bar left
Normal Text Double bar left
Normal Text Stress Marking
Normal Text Superscript
Normal Text Subscript

@Mq-b
Copy link
Author

Mq-b commented Oct 31, 2024

No problem, I re-downloaded the source code to compile and build, the only difference is that I used cmake --build. and cmake --install. .

@flagarde
Copy link
Collaborator

flagarde commented Oct 31, 2024

The problem is, aren't you still relying on the GNU Toolchain? If it's windows, how about using the VC toolchain?

Your README also mentions that the library is cross-platform and supports Linux, windows, and macOS.
How could the CMakeList imported to the library be written this way?

The library is cross-platform and I don't assume GNU toolchain. In windows I test the code with Clang Clang-cl and MSVC. I just do the coding in a linux environnement as it's my main system.

Windows is really a pain and always as "subtil" to be polite, but I fix them with time. The main problem now is the way Windows handle shared library. You need to export explicitly the functions etc and it is not done. there is an cmake option to do this for you but I hagen't done it yet. The way Windows is doing is the best way (at least this time) but is cumbersome for a UNIX user who compiler export by default https://stackoverflow.com/questions/2164827/explicitly-exporting-shared-library-functions-in-linux

This library is really cross-platform. It is not relaying on UNIX or fully POSIX subsystem like MSYS2 etc but it can be compile with them too

I you are doubtful please have a look on the workflows. It's even a good help to know how to run CMake on such system. Again Windows is always quite tricky for me and has a "logic" I rarely understand.

@flagarde
Copy link
Collaborator

@Mq-b
Copy link
Author

Mq-b commented Nov 1, 2024

My problem is that I can't use cmake to introduce this library in windows the usual way, but other cross-platform libraries are fine.

@flagarde
Copy link
Collaborator

flagarde commented Nov 1, 2024

@Mq-b Could you give explain why ? CMake is available in the Visual bundle

@Mq-b
Copy link
Author

Mq-b commented Nov 2, 2024

Under Ubuntu I can introduce it by using the following CMake:在Ubuntu下,我可以通过使用以下CMake来介绍它:

cmake_minimum_required(VERSION 3.10)
project(test_project)

find_package(cpp-terminal REQUIRED)
find_package(Threads REQUIRED)

add_executable(test-standalone test.cpp)
target_link_libraries(test-standalone PRIVATE cpp-terminal::cpp-terminal Threads::Threads)

On the other hand, in windows, it does not, it says the error can not be found:另一方面,在windows中,它不,它说错误无法找到:

include("${CMAKE_CURRENT_LIST_DIR}/cpp-terminalTargets.cmake")

cmake: cmake:

set(cpp-terminal_DIR "D:/project/cpp-terminal/build/cmake")
find_package(cpp-terminal REQUIRED)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE cpp-terminal::cpp-terminal Threads::Threads)

Like I said before, I don't know why.

@Mq-b
Copy link
Author

Mq-b commented Nov 2, 2024

I recompiled the build and found that there was still only one cmake file in the directory.我重新编译了构建,发现目录中仍然只有一个cmake文件。

git clone https://github.com/jupyter-xeus/cpp-terminal.git
cd D:\project\test_cmake
mkdir build
cd .\build\
cmake ..
cdcmake --build .
PS D:\project\test_cmake\cpp-terminal\build> cd .\cmake\
PS D:\project\test_cmake\cpp-terminal\build\cmake> ls


    Directory: D:\project\test_cmake\cpp-terminal\build\cmake


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        2024/10/27      9:36           1019 cpp-terminalConfig.cmake

1

@Mq-b
Copy link
Author

Mq-b commented Dec 13, 2024

I pulled the latest code, tried to compile and build on Windows again, and this time I modified the build command:

Note

that I'm using the MSVC toolchain, using its terminal.

git clone https://github.com/jupyter-xeus/cpp-terminal.git
cd cpp-terminal
mkdir build
cd build
cmake ..
cmake --build . --config Debug
cmake --build . --config Release
cmake --install . --config Debug
cmake --install . --config Release

I'm using two commands in my own project to introduce:

find_package(cpp-terminal REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE cpp-terminal::cpp-terminal)

Then I found that the error include was missing, and the file in the private folder was missing, so I manually copied it to solve this problem.

The build in Debug mode was successful, but in Release mode, it failed with linking errors. The issue seems to be related to the PackageConfig; it is still linking as if it were in Debug mode. In Windows, the symbols used in Debug and Release modes are different, which causes the symbol mismatch problem.

And I found that the install command doesn't install both Debug and Release's .lib static libraries, which is not related to the current problem, but it is also a problem.

But the good news is that it no longer reports an error about not finding "cpp-terminalTargets.cmake".

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

No branches or pull requests

2 participants