Gcc fails to recognize `-I../path`

2019-07-23 12:07发布

问题:

I have a problem with linking and gcc, probably resulting from a stupid mistake on my side. Drawing from this post Header files linked to from header file not found, I tried the -I option to inlcude header files, but gcc just does not seem to recognize the parameter.

~/Documents/projects/opencl/NVIDIA_GPU_Computing_SDK/src_l$ gcc opencl_hello_world.c –I../OpenCL/common/inc/CL/ –L/usr/local/cuda/lib –lOpenCL
gcc: –I../OpenCL/common/inc/CL/: No such file or directory
gcc: –L/usr/local/cuda/lib: No such file or directory
gcc: –lOpenCL: No such file or directory
In file included from opencl_hello_world.c:6:
../OpenCL/common/inc/CL/opencl.h:42:40: error: ../OpenCL/common/inc/CL/cl.h: No such file or directory
../OpenCL/common/inc/CL/opencl.h:43:43: error: ../OpenCL/common/inc/CL/cl_gl.h: No such file or directory
../OpenCL/common/inc/CL/opencl.h:44:47: error: ../OpenCL/common/inc/CL/cl_gl_ext.h: No such file or directory
../OpenCL/common/inc/CL/opencl.h:45:44: error: ../OpenCL/common/inc/CL/cl_ext.h: No such file or directory

When I input the command cd ../OpenCL/common/inc/CL/ it brings me to the right folder with the right header files in it.

What do I do wrong?

回答1:

Check if - in -I, -L, -l is not in some other language.

It seems like some unicode symbol, not ascii.

That's why they are not recognized as gcc options but source files.