小编ieg*_*god的帖子

Linux驱动程序和device.h

我有一些直接来自制造商的canbus硬件的Linux驱动程序,但它们已经过时了(至少我的内核),让我自己照顾自己.在跳过一些箍之后,我在编译中遇到了一个错误,但这是一个我似乎无法动摇的错误.

错误是这样的:

./src/esdcan_pci.c:353:9: error: ‘struct device’ has no member named ‘driver_data’
Run Code Online (Sandbox Code Playgroud)

经过大量的互联网调查后,我几乎可以肯定它与我的内核device.h的头文件有关.我已打开标题并查看结构,果然,没有名为driver_data的成员.我不确定的是哪个成员是等价的,或者根本就是一个成员.这是我头文件中结构的版本:

struct device {
    struct device       *parent;

    struct device_private   *p;

    struct kobject kobj;
    const char      *init_name; /* initial name of the device */
    struct device_type  *type;

    struct mutex        mutex;  /* mutex to synchronize calls to
                     * its driver.
                     */

    struct bus_type *bus;       /* type of bus device is on */
    struct device_driver *driver;   /* which driver has allocated this
                       device */
    void        *platform_data; /* Platform specific data, device
                       core …
Run Code Online (Sandbox Code Playgroud)

c drivers linux-kernel

3
推荐指数
1
解决办法
4262
查看次数

链接错误与Lua?

我有一个简单的测试应用程序,我正在尝试用Lua(在Linux上)用C++构建.构建线看起来像这样:

g++ -o"LuaTest" ./src/LuaTest.o -l/home/diego/lua-5.1.4/src/liblua.a
Run Code Online (Sandbox Code Playgroud)

并且它吐出了这个错误:

/usr/bin/ld: cannot find -l/home/diego/lua-5.1.4/src/liblua.a
Run Code Online (Sandbox Code Playgroud)

这将是一切都很好,除了我正盯着liblua.a正好在那个文件夹中.我在Windows下使用MinGW和Lua的Windows二进制文件尝试了类似的配置,令人震惊的是我得到了完全相同的结果,只是它抱怨lua51.lib或lua5.1.lib或我尝试的任何文件.

我在这里错过了什么?

如果重要的是这里的应用程序:

extern "C"
{
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}

int main()
{
    return 0; //this really should compile -_-
}
Run Code Online (Sandbox Code Playgroud)

c++ linker lua

2
推荐指数
1
解决办法
1291
查看次数

标签 统计

c ×1

c++ ×1

drivers ×1

linker ×1

linux-kernel ×1

lua ×1