quarkslab / NFLlib

NTT-based Fast Lattice library
MIT License
167 stars 52 forks source link

Undefined reference to "nfl::params<unsigned int>::P" #50

Closed shane-yeo closed 4 years ago

shane-yeo commented 4 years ago

I was able to successfully build the library, and all tests are successful during the build. However, I encountered the following error when compiling a simple test program:

/usr/bin/ld: /tmp/ccKiADHL.o: in function `nfl::poly<unsigned int, 512ul, 1ul>::get_modulus(unsigned long)':
main2.cpp:(.text._ZN3nfl4polyIjLm512ELm1EE11get_modulusEm[_ZN3nfl4polyIjLm512ELm1EE11get_modulusEm]+0x1b): undefined reference to `nfl::params<unsigned int>::P'
collect2: error: ld returned 1 exit status

I ran the following to compile the program:

g++ -I/root/nfllib/include -L/root/nfllib/lib -lnfllib -lnfllib_static main2.cpp

This is the source code for my program:

#include "nfl.hpp"

using poly_type = nfl::poly_from_modulus<uint32_t, 512, 30>;

int main(int argc, char *argv[])
{
    poly_type P;
}

Is there anything wrong with my source code above? I appreciate any help on how I can resolve this error. Thank you.