fatal error: sodium.h: No such file or directory

二次信任 提交于 2021-01-29 20:35:50

问题


Thank you @stark I was unaware you had to link the directory as part of #include. This part is now working though when I include.

(sodium_init() < 0)
    {
        printf("Sodium could not be initialized");
        return 1;
    }

                                                                                                                                      

I now receive the error "undefined reference to 'sodium_init'.

I have tried adding -lsodium to the compile command (gcc -g -lsodium file1.c file2.c file1.h -o file1.c.exe) which gives the error.

"cannot find -lsodium collect2.exe: error: ld returned 1 exit status"

Through further searching I believe I need to tell the compiler where to find -lsodium though cannot find out how.

-- below has been solved using @stark advice -- I have been trying to get the sodium library working for the last 3 days. I have followed the instillation instructions here(https://libsodium.gitbook.io/doc/installation) which all appear to have completed successfully, but still receive the error.

I then found information suggesting I have not linked Visual Studio (community edition) to the library location.

I have attempted to follow the instructions here(https://www.learncpp.com/cpp-tutorial/a2-using-libraries-with-visual-studio-2005-express/) but cannot see "VC++ Directories". I have tried several other sets of directions with the same outcome.

Is anyone able to help getting the sodium library working so I can get access to the RtlGenRandom() function?

来源:https://stackoverflow.com/questions/63546518/fatal-error-sodium-h-no-such-file-or-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!