Problems with linker and new functions

13 views
Skip to first unread message

Andrii302

unread,
Jul 10, 2024, 1:33:52 AM (6 days ago) Jul 10
to flint-devel
Good day,
I have written some new functions, called fmpz_mod_mpoly_q_... creating header 'fmpz_mod_mpoly_q.h' for them and an appropriate folder. But after installing flint with those added functions, I still cannot run an example file that uses them.
The ubuntu command line I run is:
gcc fmpz_mod_mpoly_q.c -lflint

Where 'fmpz_mod_mpoly_q.c' is just an example program that imports and uses those newly added functions. The line that does that looks like following:

#include <flint/fmpz_mod_mpoly_q.h>

The error message I get it following:

fmpz_mod_mpoly_q.c: In function ‘main’:
fmpz_mod_mpoly_q.c:41:5: warning: implicit declaration of function ‘fmpz_mod_mpoly_q_mul’; did you mean ‘fmpz_mod_mpoly_mul’? [-Wimplicit-function-declaration]
   41 |     fmpz_mod_mpoly_q_mul(x, x, y, ctx);
      |     ^~~~~~~~~~~~~~~~~~~~
      |     fmpz_mod_mpoly_mul
fmpz_mod_mpoly_q.c:45:5: warning: implicit declaration of function ‘fmpz_mod_mpoly_q_clear’; did you mean ‘fmpz_mod_mpoly_clear’? [-Wimplicit-function-declaration]
   45 |     fmpz_mod_mpoly_q_clear(x, ctx);
      |     ^~~~~~~~~~~~~~~~~~~~~~
      |     fmpz_mod_mpoly_clear
/usr/bin/ld: /tmp/cccnSF1q.o: in function `main':
fmpz_mod_mpoly_q.c:(.text+0x113): undefined reference to `fmpz_mod_mpoly_q_init'
/usr/bin/ld: fmpz_mod_mpoly_q.c:(.text+0x12c): undefined reference to `fmpz_mod_mpoly_q_init'
/usr/bin/ld: fmpz_mod_mpoly_q.c:(.text+0x150): undefined reference to `fmpz_mod_mpoly_q_set_str_pretty'
/usr/bin/ld: fmpz_mod_mpoly_q.c:(.text+0x170): undefined reference to `fmpz_mod_mpoly_q_print_pretty'
/usr/bin/ld: fmpz_mod_mpoly_q.c:(.text+0x1a8): undefined reference to `fmpz_mod_mpoly_q_set_str_pretty'
/usr/bin/ld: fmpz_mod_mpoly_q.c:(.text+0x1d1): undefined reference to `fmpz_mod_mpoly_q_mul'
/usr/bin/ld: fmpz_mod_mpoly_q.c:(.text+0x1f1): undefined reference to `fmpz_mod_mpoly_q_get_str_pretty'
/usr/bin/ld: fmpz_mod_mpoly_q.c:(.text+0x234): undefined reference to `fmpz_mod_mpoly_q_clear'
/usr/bin/ld: fmpz_mod_mpoly_q.c:(.text+0x252): undefined reference to `fmpz_mod_mpoly_q_clear'
collect2: error: ld returned 1 exit status

The error only concerns my newly added functions, all the original ones like 
'fmpz_clear' or 'flint_printf' are imported and compiled just fine.

So, are there any extra steps I am missing when adding new functions to flint or what could be a problem?

Thanks in advance!

Cheers,
Andrii Yanovets

Edgar Costa

unread,
Jul 10, 2024, 11:16:06 AM (6 days ago) Jul 10
to flint...@googlegroups.com
You are adding a new module; you will need to modify the Makefile.in to compile the objects in the new directory.
One could potentially be more helpful if given a fork/branch to look at.

Cheers,
Edgar



--

---
You received this message because you are subscribed to the Google Groups "flint-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flint-devel...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/flint-devel/42342cfe-44bd-47c4-84ef-c4fb9861e7fdn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages