Cannot find <library path>: Permission Denied
-
@Laner107 said in Cannot find <library path>: Permission Denied:
No because the filename is libcurl?
It doesn't matter, when using -l you do not specify the prefix (lib) and you do not specify file name extension (dll, so). At least it is like this on UNIX/Linux.
-
@jsulm So now its saying, "cannot find -lcurl" so i assume for windows we keep the actual name? And if its not that do you have any idea why it would be giving me the undefined errors even though they are in the library, and how do i know if its not compaitable?
-
@Laner107 said in Cannot find <library path>: Permission Denied:
And if its not that do you have any idea why it would be giving me the undefined errors even though they are in the library
I already wrote that this is either:
- Those functions are not in that lib, or
- The lib is not found, or
- The lib is not compatible (built with different compiler or for different architecture)
Can you post the whole build log?
-
@jsulm Is this the log you are looking for?
14:55:14: Running steps for project AlgoApplicationUI... 14:55:14: Configuration unchanged, skipping qmake step. 14:55:14: Starting: "C:\Qt\Tools\mingw730_64\bin\mingw32-make.exe" -j8 C:/Qt/Tools/mingw730_64/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory 'C:/Users/laner/Documents/GitHub/AlgoApp/Program/QT UI/AlgoApplicationUI' g++ -Wl,-subsystem,windows -mthreads -o debug\AlgoApplicationUI.exe debug/MainWindow.o debug/login.o debug/main.o debug/webscrapper.o debug/qrc_res.o debug/moc_MainWindow.o debug/moc_login.o -LC:\Users\laner\Documents\GitHub\AlgoApp\Program\Libraries\curl-7.69.1\x64Release\lib -llibcurl C:\Qt\5.14.2\mingw73_64\lib\libQt5Charts.a C:\Qt\5.14.2\mingw73_64\lib\libQt5Widgets.a C:\Qt\5.14.2\mingw73_64\lib\libQt5Gui.a C:\Qt\5.14.2\mingw73_64\lib\libQt5Core.a debug\myapp_res.o.txt -lmingw32 C:\Qt\5.14.2\mingw73_64\lib\libqtmain.a -LC:\openssl\lib -LC:\Utils\my_sql\mysql-5.7.25-winx64\lib -LC:\Utils\postgresql\pgsql\lib -lshell32 debug/MainWindow.o: In function `CurlObj::CurlObj(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)': C:\Users\laner\Documents\GitHub\AlgoApp\Program\QT UI\AlgoApplicationUI/MainWindow.cpp:37: undefined reference to `__imp_curl_easy_init' C:\Users\laner\Documents\GitHub\AlgoApp\Program\QT UI\AlgoApplicationUI/MainWindow.cpp:42: undefined reference to `__imp_curl_easy_setopt' C:\Users\laner\Documents\GitHub\AlgoApp\Program\QT UI\AlgoApplicationUI/MainWindow.cpp:43: undefined reference to `__imp_curl_easy_setopt' C:\Users\laner\Documents\GitHub\AlgoApp\Program\QT UI\AlgoApplicationUI/MainWindow.cpp:44: undefined reference to `__imp_curl_easy_setopt' C:\Users\laner\Documents\GitHub\AlgoApp\Program\QT UI\AlgoApplicationUI/MainWindow.cpp:45: undefined reference to `__imp_curl_easy_setopt' C:\Users\laner\Documents\GitHub\AlgoApp\Program\QT UI\AlgoApplicationUI/MainWindow.cpp:46: undefined reference to `__imp_curl_easy_perform' collect2.exe: error: ld returned 1 exit status mingw32-make[1]: *** [Makefile.Debug:84: debug/AlgoApplicationUI.exe] Error 1 mingw32-make: *** [Makefile:45: debug] Error 2 mingw32-make[1]: Leaving directory 'C:/Users/laner/Documents/GitHub/AlgoApp/Program/QT UI/AlgoApplicationUI' 14:55:16: The process "C:\Qt\Tools\mingw730_64\bin\mingw32-make.exe" exited with code 2. Error while building/deploying project AlgoApplicationUI (kit: Desktop Qt 5.14.2 MinGW 64-bit) When executing step "Make"
-
@Laner107
Every example on the web (gcc
) uses-lcurl
, not-llibcurl
. I don't think that would change for Windows, unless you have something which says that? It concerns me you say that generates"cannot find -lcurl"
. Do you want to tell us what exactly there is inC:\Users\laner\Documents\GitHub\AlgoApp\Program\Libraries\curl-7.69.1\x64Release\lib
that looks something likelibcurl.a
? -
@Laner107
You don't have file extensions visible (!), but that looks like a.lib
file to me, where I was expecting a.a
. I thinkmingw
now links against*.lib
files, and that might be where the difference bewteen-lcurl
vs-llibcurl
comes from.This is getting beyond my pay-grade. Wherever it came from, it's for
gcc
/mingw
, not formsvc
, is it? Did you build it or download it? Did the instructions relate to usingmsvc
ormingw
as the compiler/linker? I don't have the answers, just thoughts for you.... -
@Laner107
As I said, I don't know this stuff, I'm only guessing. I'll have to leave it for others to help.My last quick test thought is: try recompiling your application sources (not the curl ones) with
-DCURL_STATICLIB
flag, and then relink. This may be nonsense or may make no difference. Worth a try. Then I'm afraid I'm bowing out. -
Usually when linking libs in .pro files with the -l, I don't have good luck. To get it to work a lot of times I will link the lib file itself.
Here is an example of what I mean.
INCLUDEPATH += "$$PWD/vlc-qt/include" LIBS += "$$PWD/vlc-qt/libs/mingw64/libVLCQtQml.dll" LIBS += "$$PWD/vlc-qt/libs/mingw64/libVLCQtCore.dll"
This will build but I have issues when I run. I usually have to copy the .dlls into the application's build directory (the same folder as the .exe file that is built).
-
@JonB Its okay i thank you for the help!!
@MrShawn I am quite new to the idea of building and using libraries, I notice there is an actuall folder for the libraries under mingw, I decided to store my one library im using in its own folder someone else, will this effect anything or should i keep it in mingw folder? And also where can i find the .dll files for my library i built as i can only find the .lib file and include folder?
-
@MrShawn It also appear under my build settings that the build configuration is Debug and the make is a mingw32-make.exe, so does that mean my library is suppose to be a debug .lib that is also x32 instead of x64? This is all quite overwhelming and confusing and sorry if Im being a hassle.
-
@Laner107 said in Cannot find <library path>: Permission Denied:
suppose to be a debug .lib that is also x32 instead of x64?
It needs to be the same as your app. If you build your app for 32 bit then the lib must be 32bit, if you build for 64bit then the build must be 64bit. You can't mix. Also, if you build in release mode then use the lib build in release mode.
-
@jsulm I actually ended up doing that now everything matches, but it says in documentation since im doing a static library i am suppose to put CURL_STATICLIB, i just cant find out where, here is the documentation.
Building your own application with a static libcurl
When building an application that uses the static libcurl library on Windows,
you must define CURL_STATICLIB. Otherwise the linker will look for dynamic
import symbols. -
@Laner107 In your top pro file add:
DEFINES += CURL_STATICLIB