Fast Artificial Neural Network Library On Embedded Platform - c

Since this is my first question after years of finding answers in this site, id like to say a big thanks to everyone.
I want to use FANN in an embedded platform, and i am using UVision 4 to code in C.
Since i am a C/C++ rookie, i cant figure out if i can / how i can use that library.
When i try to simply include the files, i get this error:
FANN\fann.h(51): error: #5: cannot open source input file "sys/time.h": No such file or directory
which makes sense because i am not compiling for windows platform.
Can i use the FANN library for embedded C? If so, how to include it?
Thanks

You have to write your own "sys/time.h" for your embedded system. It must offer everything the original one does to be compatible with your external library. Wether you write one from scratch or wrap something around an existing code base which is compatible to your embedded device is up to you.
You can also have a look at this SO question.

If you're not compiling on windows you'll have no problem - simply include sys/time.h like this :
#include <sys/time.h>
Note the < and > character, these will make sure that your header is looked up within $PATH.
If your compiler still wont find that header you will need to install libc, on debian this can be done with tools like apt-get

Related

How to add a header file to the c project?

Am using a Dev c++ compiler, to compile a c code. (I am a beginner)
When I compile, it says 'some' header files are missing.
How can i include those header files in my system, so as to be utilized by the program??
Thanks
A header such as <sys/sem.h> which is used for the function semget() among other things, is not generally available in Windows. It's a POSIX header, and Windows does not implement the POSIX standard out of the box.
You should maybe look at the Win32 API instead, for instance a function like CreateSemaphore().
The problem is that you are trying to use the Linux API on Windows. Here is what is going on: Every operating system has its own set of libraries for programmers to use to make programs on that platform. In this instance, you are attempting to use Linux libraries on Windows. Windows doesn't have a code location called sys/ipc or sys/sem.
Furthermore, since you said you are a beginner, try finding another tutorial. sys/ipc.h and sys/sem.h are not for beginners, are are libraries typically used for communication between processes. These concepts are way beyond you right now haha :P
Here is a better place to start: http://www.cprogramming.com/tutorial/c-tutorial.html

Visual Studio cannot find some C libraries, such as stropts.h

I'm attempting to compile a sample c file that was given to me, but unfortunately, it's missing several libraries as some of the include files cannot find them. Namely: stropts.h, netdb.h, sys/socket.h, sys/ioctl.h, netinet/in.h, pthread.h, and unistd.h.
I've researched where I could fix these problems, but surprisingly there have been little to no results on this problem strangely. The Visual Studio command prompt isn't able to compile it until I can find these libraries. Anything I need to download/ link to fix this?
Those header files are not part of standard C or C++. Do not attempt to download the headers from other sources; even if you can get them to compile, they won't link properly since you don't have the implementations of the functions declared therein in a static library or DLL.
The simple fact of the matter is that the code you're trying to compile was written for Unix/Unix-like systems and it's not portable to Windows. You'll need to either significantly rewrite the code to use the equivalent Windows functionality or a 3rd-party platform-independent library (e.g. Winsock or Boost sockets for sockets), compile it on a Unix system (you could use a virtual machine if you want), or use a Unix compatibility layer such as Cygwin.

Missing header files using embedded C test environment

I am currently working on my project wherein I need to program a DSP processor for a modem to do binary FSK modulation. The system was earlier using a QPSK modulation. I have use the same infrastructure, only need to modify the frequency modulation technique. The DSP processor is simulated using a set of C files on a LINUX machine and all the code is tested out on LINUX before moving on to the actual device.
Right now I have just started with the programming and I am just trying to compile my current codeset. I am facing a lot of issues with missing header files.
The device infra files use the header files like:
filter.h,
sysreg.h,
builtins.h
Now I am getting all these headers as "file missing" errors. I was able to fix a couple with
#include <sys/reg.h>
#include <linux/filter.h>
But the builtins.h file is still missing and I am not able to compile the code.
I am using UBUNTU 11.10 and gcc version 4.6.1. Is there some special set of files that I need to update for programming with embedded C. Any help would be much appreciated.
builtins.h is a header that is part of the compiler project and specifies which functions are, literally, built-in to the language, according to the gcc docs.
Your problem is that the compiler you're using cannot find this file.
You have two options:
The first, assuming everything else is set up correctly, is to run find /usr -name "builtins.h" to locate the file and add that directory to the include (-I/path/to/dir) path.
If the system uses some form of cross compiler, make sure you're using that, rather than your host's gcc. If you aren't using the correct toolchain, I suspect you'll have problems linking, too.

Downloading Header Files

Where can i download the following header files for dev c
sys/types.h
sys/socket.h
netinet/in.h
arpa/inet.h
and also the structure
sockadder and it's derivatives?
I don't know why you need to download these specific files, since they should come with your compiler suite in most modern systems.
You should also keep in mind that they can be radically different depending on your platform and that those files often #include other non-standard files (which #include others and so on). This could make those files very hard to parse and understand.
That said, from some indeterminate version of Linux:
http://linux.die.net/include/sys/types.h
http://linux.die.net/include/sys/socket.h
http://linux.die.net/include/netinet/in.h
http://linux.die.net/include/arpa/inet.h
If you are going to replace missing files, consider getting/reinstalling a proper compiler suite and any developer packages your are missing.
If you want to look at the structure definitions you should definitely be looking at the documentation rather than the actual implementations. That way you avoid tying your code to private definitions e.t.c. that can change between systems.
EDIT:
Just to confirm some of my comments above, struct sockaddr for said version of Linux is defined piece-by-piece in:
http://linux.die.net/include/bits/socket.h
http://linux.die.net/include/bits/sockaddr.h
What SDK are you working with? For Linux you get these files as part of your core C sdk. For Windows it comes with the SDK as well. If you just want a quick and dirty look at some header files I use http://www.google.com/codesearch.
Those headers (not header files) are part of the implementation. They need not be real files.
If your implementation does not provide them, you're out of luck.
If your implementation provides them as real files and you deleted them, reinstalling the compiler might work.
If your implementation provides them as real files and you cannot reinstall the compiler your approach might work. Sorry, I have no idea where to download the files --- or why would anyone copy the files somewhere in the first place.
I'm assuming that you are trying to compile a source code for the *nix platform under another, such as Windows. This approach won't do you any good. Remember that you'll need the libraries of those headers and they are not portable.
Install a Virtual Machine with Ubuntu on your PC to do this kind of development.
do:
apt-get install gcc-4.2

Using PARI library for C

I've got all the source code for PARI, but i'm not sure how to use it/generate the pari library. Up to now, i've had to add a couple header files for things such as complex numbers using #include <complex.h>, so I figure it is the same idea for using PARI.
I add pari.h's path in my compiler and #include <pari.h> works, but creates a massive list of other errors including mostly "expected ')' before numeric constant" inside of paricfg.h.
I'm definitely doing it wrong. I know there's some semi-automated way to create a library file to import in using linux commands, but i'm using windows, and i'm not sure I can run the necessary files via cmd.
How can i utilize PARI?
Did you build the library before trying to use it? If you didn't, take a look at the INSTALL file or one of the README files.
To be able to build this type of library on Windows you'll need either MinGW or Cygwin. Although after a quick look at the README.WIN file, MinGW seems to be out of the question. You might also want to consider installing a Linux distro in a VM and using that to build and run your application.

Resources