ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
In your ad799x.h file, what is on line 121? And what is the purpose of your program/what does it do? By reading the error, it seems as you don't have a function, struct, etc properly defined. Also, if you could post more information about the header file, it would definitely help in further troubleshooting.
I'm trying to talk to the sensor AD7998, and to do that I'm supposed to use 'iio'.
The stucture is not defined in ad799x.h, that's why I think I have to include something else.
// This fixe the u16 error :
#define __KERNEL__
#include <asm-generic/int-ll64.h>
#include "ad799x.h"
g++ -I/usr/src/linux-headers-3.0.0-30-generic/include test.cpp
In file included from test.cpp:4:0:
ad799x.h:97:33: erreur: field ‘channel’ has incomplete type
channel is of type iio_chan_spec which is defined here in linux/iio/iio.h
But when I include it, I get Alot of errors
Made a few test that confirmed my original opinion: this source is meant for use in the kernel. It heavily depends on other kernel headers, not likely to be usable from user program.
Why are you using this header in user space? It's a kernel driver.
In general “u16” type is never declared by Linux headers included by user space and for user space use “__u16” is used instead. If you find yourself in need to define __KERNEL__ than you're most likely doing something you should not be doing (or there is a problem with the header file).
I'm probably doing something wrong. I thougth the driver would be the interface between the user space and the kernel. If I'm not supposed to use the driver from user space, does that mean that I have to compile a kernel module in order to be able to use the sensor AD7998? Or is there a 'normal' way to do that from user space?
I'm probably doing something wrong. I thougth the driver would be the interface between the user space and the kernel. If I'm not supposed to use the driver from user space, does that mean that I have to compile a kernel module in order to be able to use the sensor AD7998? Or is there a 'normal' way to do that from user space?
Since Linux 2.6.31 ad799x driver is in staging directory so you should use it instead of building the module itself.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.