3

I am trying to compile the code below:

#include"header.h"
int main()
{
char dateString[20], timeString[20];
struct tm *tmptr;
time_t t;
t = time(NULL);
tmptr = localtime(NULL);
printf("%d ---%s\n",tmptr,tmptr);
return 0;
}

Header.h has :

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<unistd.h>
#include<stdarg.h>
#include<time.h>
#include<utime.h>
#include<sys/timeb.h>

When compiling this code, I get an error saying that:

/usr/lib/gcc/i686-linux-gnu/5/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory

Concluding that it is trying to tell me that, the library file is missing, I went through the previous threads and tried updating gcc compiler but I still see this error. Can somebody please help me to fix it?

3

That file is provided by the libmpfr4 package, which can be installed by opening a terminal (press Ctrl+Alt+T) and running:

sudo apt-get update
sudo apt-get install libmpfr4

If it says the package is already installed, you can try:

sudo apt-get install --reinstall libmpfr4
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.