-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not able to compile my first C program on ubuntu after installing miracl #108
Comments
You need to link to the miracl library
gcc -O2 first.c miracl.a -o first
Mike
…On Thu, Nov 18, 2021 at 10:55 AM mrityunjaysingh1983 < ***@***.***> wrote:
Please help in resolving my issues. I get the following error when I
compile my C program.
gcc -I/home/mypc/Desktop/miracl/ ms.c
ms.c: In function ‘main’:
ms.c:26:1: warning: implicit declaration of function ‘cotnum’
[-Wimplicit-function-declaration]
26 | cotnum(y, stdout);
| ^~~~~~
/usr/bin/ld: /tmp/cckHid5T.o: in function main': ms.c:(.text+0x28):
undefined reference to mirsys'
/usr/bin/ld: ms.c:(.text+0x39): undefined reference to mirvar'
/usr/bin/ld: ms.c:(.text+0x4a): undefined reference to mirvar'
/usr/bin/ld: ms.c:(.text+0x65): undefined reference to expb2'
/usr/bin/ld: ms.c:(.text+0x80): undefined reference to incr'
/usr/bin/ld: ms.c:(.text+0xa0): undefined reference to big_to_bytes'
/usr/bin/ld: ms.c:(.text+0x115): undefined reference to bytes_to_big'
/usr/bin/ld: ms.c:(.text+0x144): undefined reference to `cotnum'
collect2: error: ld returned 1 exit status
#include "miracl.h"
int main()
{
int i, len;
miracl *mip = mirsys(100, 0);
big x, y;
char b[200]; // b needs space allocated to it
x = mirvar(0); // all big variables need to be "mirvar"ed
y = mirvar(0);
expb2(100, x);
incr(x, 3, x); // x = 2^100 + 3
len = big_to_bytes(200, x, b, FALSE);
// Now b contains big number x in raw binary
// It is len bytes in length
// now print out the raw binary number b in hex
for (i = 0; i < len; i++) printf("%02x", b[i]);
printf("n");
// now convert it back to big format, and print it out again
bytes_to_big(len, b, y);
mip->IOBASE = 16;
cotnum(y, stdout);
return 0;
}`
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#108>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAU3ZDVRCTUY7IMYDDQ56WTUMSPPZANCNFSM5II2ZSXA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
To install miracl in my Ubuntu system I used the following steps.
My program is present at /home/mypc/Desktop and name is ms.c My miracl.h header file is present in /home/mypc/Desktop/miracl. When I execute gcc -O2 /home/mypc/Desktop/miracl ms.c
May I know the right command to execute on my terminal if I am executing the wrong command? If I am doing other mistakes then please let me know. |
I am facing problem in installing miracl.
|
Action: To ensure this I used the following command to compile gcc –I /home/mypc/Desktop/MIRACL-master/include –c –O2 mr*.c
Action: cd /home/mypc/Desktop/MIRACL-master/source; gcc –I /home/mypc/Desktop/MIRACL-master/include –c –O2 mr*.c It gives many error. Some are as follows. Please help me in resolving these errors. mrarth1.c:56:10: fatal error: ieeefp.h: No such file or directory |
Please help in resolving my issues. I get the following error when I compile my C program.
The text was updated successfully, but these errors were encountered: