Problems with $$quote(...) when used with environment variable
Hi at all,
I’m playing a little bit with CUDA.
Fortunately, there exists a predefined environment variable called ‘CUDA_LIB_PATH’ which points to the folder with the needed library.
In my case the value of this env. var. is ‘C:\\Program Files (x86)\\NVIDIA GPU Computing Toolkit\\CUDA\\v3.2\\lib\\Win32’, thus I have to use the $$quote(…) function due to the whitespaces in it.
So I wrote the following line to my project file (cuda.lib is the needed library):
LIBS += $$quote($(CUDA_LIB_PATH)\\cuda.lib)
But this doesn’t work, the linker still gets the whitespace separated parts of the string (C:\\Program, Files, etc…).
However, if I write the value of the env. var. directly into the project file it works:
LIBS += $$quote(C:\\Program Files (x86)\\NVIDIA GPU Computing Toolkit\\CUDA\\v3.2\\lib\\Win32\\cuda.lib)
Also there is an env. var. for the include files called ‘CUDA_INC_PATH’.
In this case the following statement works:
INCLUDEPATH += $$quote($(CUDA_INC_PATH))
It is a little bit strange, ‘cause for INCLUDEPATH it works but not for LIBS.
Perhaps someone can help me.
Thanks in advance
DAXaholic
8 replies
Undocumented QMake [qtcentre.org] says the following:
escape_expand(string) — Does what quote() probably should have done originally, it replaces \\, \n, \t, and \r with backslash, newline, tab, and carriage return respectively.
Hi, I am having the same issue here.
On my PC, a path to the NVidia’s SDK is set as
NVSDKCOMPUTE_ROOT=C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0
In my project file , using this environmental variable, I set paths as
win32:INCLUDEPATH += $$quote($(NVSDKCOMPUTE_ROOT)/C/common/inc)
win32:LIBS += -L$$quote($(NVSDKCOMPUTE_ROOT)/C/common/lib/x64)
While the first line seems to work fine, the second line causes error and shows this message, at the end of the compilation….
> Generating Code…
> link /LIBPATH:“c:\Qt\4.7.3\lib” /NOLOGO /DEBUG /DLL /MANIFEST /MANIFESTFILE:“debug\mylib.intermediate.manifest” /OUT:..\QtProjects\debug\mylib.dll @C:\Users\user\AppData\Local\Temp\mylib.dll.1908.28782.jom
> LINK : fatal error LNK1104: cannot open file ‘Corporation\NVIDIA.obj’
The program compiles and runs fine if the path is hard-coded as
LIBS += -L“C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.0\C\common\lib\x64”
I have a feeling that there is a problem in interpreting the environmental variables with spaces. It is very awkward if I have to modify my project files every time NVidia releases a new SDK. I hope this issue is sorted out in the future release of Qt.
Thank you.
You must log in to post a reply. Not a member yet? Register here!


