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.
Related
What's the best way to create from scratch a cross-platform C library?
The platform-independent code isn't my problem, it's almost already written. It's rather the IDE-integration and building/compilation part I'm unable to wrap my head around (VS at most).
Having one header file exposing the functions.
Having another c-File for each platform to implement the platform-specific stuff, using #ifdef-guards to prevent other platforms from compiling the non-relevant part.
I successfully managed to create an XCode project and compile it on Mac OS X (xy.h and xy.macos.c).
I've already added xy.win32.c. What's the easiest way now to import this into Visual Studio and just make it compile?
Is it considered good practice to have all these files in one place (.sln and .vcproj along with .xcodeproj) ? If not, what's the commonly used structure?
For Linux, this shouldn't be any problem as I'm quite familiar on the CLI using make and gcc.
Note: There are no other dependencies except the OS-specific function calls.
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
Though this is my first question on the StackOverflow, I consider myself a long time member of the community.
Considering myself as a pre-intermediate programmer, I'll try to be as specific as possible.
I'm writing a Python package that uses a C dll to load image files with ctypes. I'm using Python 3.3.5 32bits version on Windows 8 x64. I had to build the dll from the C code. The dll is stb_image.h which is available in GitHub. I used Code::Blocks version 13.12 with the GCC compiler. The dll seems to have built fine.
By my definition, the dll is must be in the same folder as the py code file that wraps its functions, but when ctypes attempts to load the dll an exception is raised: the [in]famous WindowsError: [Error 126] Module not found.
I've found several similar questions and attempted to glean from their solutions by
adding the dll path via os.environ['PATH']
adding the dll path manually in the Path environment variable
changing the current working directory with os.chdir()
using the file module attribute to locate the library
none of these solved the issue
The stb_image library itself has no dependencies so I don't understand why windows can't find it since the dll is where it should be and the path addresses it's exact location. And, of course, there's a lot of other ways to get the job done: PyGame, pySFML (which also uses stb_image), PIL, PyPng, PySDL, you name it, but I'm doing this mostly for learning purposes.
At the writing of this question, something popped up in my head (which may or may not have any relation with the problem): whenever I compile and link programs with GCC and try to run them, I got a message box telling me that some dll (libgcc.dll or something like that) was not found. Could that be the reason Windows can't load stb_image.dll?
I tried everything my experience allowed me to do to solve it but it was not enough. Would you guys, please, give me a light on this?
PS.: Sorry for any bad english. I'm natural from Brazil.
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.
There is few files with .c anf .h extensions (cmdline.c cmdline.h core.c core.h and so on) in src directory, also there is one file "MakeFile" without extension. Is there any possibility to build these source files into some executable file on Windows 7 (64bits) ? I think i need to download compilers for C or some sdks right?
Yes.
You need to:
download and install a C/C++ compiler (I recommend TDragon's distribution of MinGW ),
add the compiler to your PATH (the installer can do it for you most of the cases); verify it's done by opening cmd.exe and typing gcc -v and mingw32-make -v, both should give you half a screenful of version information if your path is set correctly,
via cmd.exe, navigate to the folder in which the Makefile resides and call mingw32-make.
From now on everything should compile automatically. If it doesn't, post the errors.
Update:
First of all, it'd be useful for you to get the MSys package. Install it and you'll have a more recent version of make (use it instead of mingw32-make from now on).
About the CreateProcess bug, it has to do with the system PATH variable being too long. You'd need to do something like this:
open cmd
execute set PATH=c:/mingw32/bin;c:/msys/1.0/bin (change the paths here to reflect your own installation if it's different)
then as before: navigate to your project's directory, run make. Everything should be smooth now if you're not missing any external libraries.
BTW- remember not to install MinGW or MSys in directories with spaces.
I am not a Windows Developer..
But still as per my knowledge. Visual Studio (i.e 2008, I guess) has the ability to read the Makefile.
Please have a look at it..and if needed change this makefile to their format..
There are many opensource product which are platform independent..and they get compiled on both OS with the just Makefile they provided.
Or else use 'cygwin'
Developer C++ works in windows but it is actually GCC code bought into Windows, Is anyone familiar about the procedure they used to convert the linux ( .sh) to executables ??
I think i need to download compilers for C or some sdks right?
A compiler certainly, but what additional libraries you may need will depend entirely on the code itself. A successful build may also depend on the intended target of the original code and makefile. The makefile may be a GNU makefile, but there are other similar but incompatible make utilities such as Borland Make and MS NMake. If it is a simple build, you may be able to avoid the makefile issue altogether and use the project management provided by an IDE such as Visual C++ 2010 Express.
If you do not know what this code is or what it does and what it needs to build, you are taking a risk building it at all. Maybe you should post a link to the original source so that you can get more specific advice on how to build it.
[EDIT]
Ok, now looking at the code you are attempting to build, it is a very simple build, so if you wanted to avoid using GNU make, then you could just add all the *.c files in the src folder to a project in your IDE and build it.
However there is one serious gotcha, it uses the BSD sockets API and Linux system headers. You will need to first port the code to Windows APIs such as WinSock (very similar to BSD Sockets), or build it under Cygwin (a sledgehammer for a nut somewhat). There may be other Linux dependencies that need sorting, I have not looked in detail, but it looks fairly simple. That said, if you did not have the first clue regarding compiling this stuff, then perhaps this is not a task you could do?
Of course compiling the code may only be half teh problem, if it was designed to run on Linux, there may be run-time dependencies that prevent it running on Windows. Again I have not looked in detail.
Also looking at the code, I would suggest some caution, this may not be the best quality code. That may be unfair, but one obvious flaw and an indication if inexperience is the lack of include guards in the headers.