English 中文(简体)
开办共享图书馆的方案
原标题:Error when running program with sharing library

该法典有:

#include <cstdlib>
#include <clang-c/Index.h>

using namespace std;

int main(int argc, char** argv)
{
    CXIndex Index = clang_createIndex(0, 0);
    CXTranslationUnit TU = clang_parseTranslationUnit(Index, 0, argv, argc, 0, 0, CXTranslationUnit_None);
    for (unsigned I = 0, N = clang_getNumDiagnostics(TU); I != N; ++I)
    {
        CXDiagnostic Diag = clang_getDiagnostic(TU, I);
        CXString String = clang_formatDiagnostic(Diag,
                clang_defaultDiagnosticDisplayOptions());
        fprintf(stderr, "%s
", clang_getCString(String));
        clang_disposeString(String);
    }
    clang_disposeTranslationUnit(TU);

    clang_disposeIndex(Index);

    return 0;
}

并用下列国旗汇编:

g++ main.cpp -g -fno-rtti `llvm-config --cxxflags --ldflags --libs` -lclang -o main

然而,当我想主人时:

./main

之后有以下错误:

./main: error while loading shared libraries: libclang.so: cannot open shared object file: No such file or directory

然而:

$ sudo find / -name libclang.so
/usr/local/lib/libclang.so

Library seems to be on place. How to run this program?

最佳回答

ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/lib and /usr/lib)

履历<条码>页: 1,然后,如果该笔工作试图浏览文件/etc/ld.so,则与“/usr/ local/lib”相匹配,然后运行<条码>页: 1。

Commands:

  1. 维持以下指挥,然后试图再次汇编/管理

    页: 1

  2. 如果这样做的话,那么就这样做了,然后又试图汇编/篡改。

    echo "/usr/local/lib" >> /etc/ld.so.conf 页: 1

问题回答

暂无回答




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签