User forums > Using Code::Blocks

can't jump to definition of std::string_view

(1/2) > >>

mayaming:
hi,

I'm new to code blocks. I write my first cpp console application but can't jump to declaration or implementation of std::string_view when I right click those menu items. Meanwhile, it works for std::string. Since string_view is supported since c++ 17, I'm wondering if it is because codeblock doesn't support declaration or implementation jumping for those added after c++ 17?

The "-std=c++20" option is checked in compiler settings and it could build and run correctly. My g++ version is:

g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Here's the code:

--- Code: ---#include <iostream>
#include <string>
using namespace std;

int main()
{
    string s("Hello world!");
    string_view sv(s.c_str(), 5);
    cout <<sv <<endl;
    return 0;
}

--- End code ---

Thanks!


 

Miguel Gimenez:
The "legacy" Code Completion plugin cannot cope with the complexities of recent C++ standards. The Clangd-plugin should work, but only recent C::B versions incluye it (you did not specify your C::B version).

Look for Clangd in the wiki for more information.

ollydbg:
What is your C::B version? Maybe you can try the clangd_client plugin.

mayaming:
Thanks Gimenez and ollydbg! Here's my C::B information, Build Sep 14 2024:

Name                   : Code::Blocks
Version                : svn-r13570
SDK Version            : 2.25.0
Scintilla Version      : 3.7.5
Author                 : The Code::Blocks Team
E-mail                 : info@codeblocks.org
Website                : https://www.codeblocks.org
OS                     : Linux 6.8.0-45-generic x86_64
Desktop environment    : GNOME
Scaling factor         : 1.000000
Detected scaling factor: 1.000000
Display PPI            : 96x96
Display count          : 1
Display 0              : XY=[0,0]; Size=[1920,1080]; Primary

wxWidgets Library (wxGTK port)
Version 3.2.2 (Unicode: wchar_t, debug level: 1),
Runtime version of toolkit used is 3.24.
Compile-time GTK+ version is 3.24.36.

I'm using Ubuntu 22.04.5 LTS in a vmware player.

I followed the steps on https://wiki.codeblocks.org/index.php/CB_Clangd_Client. I installed clang-16:

Debian clangd version 16.0.6 (15~deb12u1)
Features: linux+grpc
Platform: x86_64-pc-linux-gnu

But I got stuck in this step:

Navigate to Setting->Plugins->Manage Plugins and enable Clangd_client.

I don't have the "Clangd_client" item to enable. Is it a problem of my C::B version?

ollydbg:

--- Quote from: mayaming on September 27, 2024, 01:27:40 pm ---
Navigate to Setting->Plugins->Manage Plugins and enable Clangd_client.

I don't have the "Clangd_client" item to enable. Is it a problem of my C::B version?

--- End quote ---

Where did you install/download the C::B? Do you build it yourself?

It is very strange that you don't have "Clangd_client" plugin installed.

Navigation

[0] Message Index

[#] Next page

Go to full version