issues linking pbc library into the C program in eclipse - c

PBC library is installed in my system and I want to use it in my C program in Eclipse. So, I passed the include path and library path of PBC to the compiler. Later, when I try to build the program it gives the following error:
cc1: fatal error: /usr/local/include/pbc: No such file or directory

Related

Linking libraries with a MinGW project in VS code

I am using MinGW version 4.5.2 on windows 10. I am trying to link multiple libraries to a project in VS code. When I try run this command: g++ main.c -o main.exe -I"C:\\Users\\USER\\Programming\\OPenGL Library\\glfw\\include\\glfw3.h" -L"C:\\Users\\USER\\Programming\\OpenGL Library\\glfw\\lib-mingw-w64\\". I get a compile error: main.c:2:24: fatal error: GLFW\glfw3.h: No such file or directory What is wrong with the command above that gives this linking error. As far as I can tell I have pointed MinGW to the library and specified the header file. I am not sure what else I need to add to the command for link the GLFW library as well as other libraries such as GLEW or glm.
If your include directive looks like
#include <GLFW/glfw3.h>
you need to supply a path to a directory which itself contains a directory named GLFW.

Error on Linking a C library: libsodium.la file not recognized

I want to use a library in C so I've downloaded it (libsodium) and I'm trying to use it with a simple program and I cannot make Codeblocks to recognise it.
I get the following error
libsodium.la: file not recognized: file format not recognized
collect2.exe: error: ld returned 1 exit status
My Specs:
Architecture x64
Codeblocks
Windows 10
MinGW
I'm using the pre-builts available in the library resources and copying them into MinGW local folder and binding them to the linker following a codeblocks tutorial
What am I possibly doing wrong?
Was the prebuilt library also x64?
Did you link with the .la file instead of the .a file by mistake?
In Code::Blocks add the path where libsodium.a is to the library search path and add sodium as a library (or -lsodium as linker flag)
Have you tried building libsodium yourself? If you have MSYS2 it's not that hard:
# change the following line to the location where you want to install libsodium
INSTALLPREFIX=/usr/local
./configure --prefix=$INSTALLPREFIX --enable-blocking-random LDFLAGS="-Wl,--as-needed -lssp" &&
make install-strip &&
echo Success

How to add C graphics.h library in Eclipse IDE

I'm trying to use some C graphic functions in Eclipse. I've copied WinBGIm files in the include/lib directories inside MINGW, but graphics.h library doesn't work yet.what is the solution?
c:\mingw\include\graphics.h:30:10: fatal error: sstream: No such file or directory

Where to put libwebsocket.h file

I'm trying to test the libwebsockets API https://github.com/warmcat/libwebsockets/tree/master/minimal-examples/api-tests/api-test-lws_tokenize
Whenever I type
cmake . && make
to build the code. I got following error.
Scanning dependencies of target lws-api-test-lws_tokenize
[ 50%] Building C object CMakeFiles/lws-api-test-lws_tokenize.dir/main.c.obj
C:\Users\pro12\Desktop\New folder (2)\libwebsockets\minimal-examples\api-
tests\api-test-lws_tokenize\main.c:16:27: fatal error: libwebsockets.h: No
such file or directory
#include <libwebsockets.h>
^
compilation terminated.
My question is where to add libwebsockets.h file?
I have mingW installed and i'm using gcc compiler. I have libwebsockets build downloaded from here https://ci.appveyor.com/project/lws-team/libwebsockets which is placed at C:\Program Files (x86)/libwebsockets

Trouble linking a mex file to static mpfr library

I am trying to compile a mex file that requires the mpfr C library, using MATLAB R2013a on Mac OS 10.8.5. I would like it to run on systems that don't have a separate installation of MPFR, so I am trying to include the static library:
mex my_program.c libmpfr.a
I copied the libmpfr.a library into the folder with my source code to simplify things. When I run this command I get the following error message:
ld: targeted OS version does not support use of thread local variables in _mpfr_add for architecture x86_64
A little research suggested that this issue could be due to a problem with the llvm-gcc-4.2 compiler that comes with Xcode and is used in MATLAB by default. So, I tried to set up a different compiler. I got GCC 4.7.4 (the latest version supported by MATLAB) from MacPorts, as described here: http://www.ficksworkshop.com/blog/14-coding/65-installing-gcc-on-mac. Next, I edited the mexopts.sh file to point MATLAB to the correct compiler, by entering the following settings:
CC='/opt/local/bin/gcc-mp-4.7'
CXX='/opt/local/bin/g++-mp-4.7'
Now when I try to compile, I get a different error message:
In file included from /Applications/MATLAB_R2013a.app/extern/include/matrix.h:294:0,
from /Applications/MATLAB_R2013a.app/extern/include/mex.h:58,
from include/main.h:5,
from include/poisson.h:7,
from src/main.c:22:
/Applications/MATLAB_R2013a.app/extern/include/tmwtypes.h:61:21: fatal error: float.h: No such file or directory
If, in mexopts.sh, I additionally set
SDKROOT='/opt/local/'
or a number of other choices (based on the locations of different copies of float.h that I can find on my system), I instead see
my_program.c:10:20: fatal error: stdlib.h: No such file or directory
So it seems that GCC-MP-4.7 is having trouble locating all of the standard C libraries.
I'd be grateful for a solution to either of these issues (linking to static mpfr useing the default compiler, or configuring GCC 4.7 to find the standard C libraries).
I found that the "thread local variables" error was caused by the compiler trying to include backwards-compatibility to OSX 10.5. Since I don't need it to do this, I edited the mexopts.sh file, replacing this line
MACOSX_DEPLOYMENT_TARGET='10.5'
with this:
MACOSX_DEPLOYMENT_TARGET='10.8'
This resulted in the mex file compiling successfully using the built-in Xcode compiler.

Resources