GCC: Compiling an OpenCL host on Windows
2014-04-10 18:06
501 查看
I just wanted to try out using OpenCL under Windows. Abstract: I got an " undefined reference to" error when I tried to compile (using the command gcc my.o -o my.exe -L "C:\Program Files (x86)\AMD APP\lib\x86_64" -l OpenCL).
|
share|improve this question | edited Sep 15 '12 at 14:53 | asked Sep 15 '12 at 13:29 fridojet 416515 |
Can you try duplicating the backslashes in the gcc parameters? Like "C:\\Program Files (x86)\\..."? Otherwise they might get escaped and break the path. Unsure this is the reason but you never know. – Thomas Sep 15 '12 at 15:03 | |||
@Thomas Thanks for your idea, but that didn't change anything. – fridojet Sep 15 '12 at 15:13 | |||
Does it say something different if you drop the -L parameter and instead give it the full path to OpenCL.lib? So remove -Lpath and add an unqualified "C:\Program Files (x86)\...\x86_64\OpenCL.lib" to tell gcc "hey here's a file you might find useful"? – Thomas Sep 15 '12 at 15:16 | |||
@Thomas Did you mean something like gcc addition.o -o addition.exe "C:\Program Files (x86)\AMD APP\lib\x86_64\OpenCL.lib" -l OpenCL? – fridojet Sep 15 '12 at 15:24 | |||
| Ok, never mind then, the fact that it returned that means it correctly finds the OpenCL library the way you're doing now - it just fails to link against it. Try -static flag... – Thomas Sep 15 '12 at 15:36 |
comments
2 Answers
activeoldestvotesup vote4down voteaccepted | The default MinGW distribution only ships tools for building x86 applications. You cannot link against the x64 version of the OpenCL library. So you either have to use MinGW-w64 or use the x86 version (change the library path to the x86 subfolder of the APP SDK).
| ||||
comment |
![](https://d36aw3ue2ntmsq.cloudfront.net/Advertisers/4c4f1be011a447efbce49c1811022e7a.png)
![](https://engine.adzerk.net/i.gif?e=eyJhdiI6NDE0LCJhdCI6NCwiY20iOjg0NywiY2giOjExNzgsImNyIjo1OTE5LCJkaSI6ImEzYjUyNTk2MTlhYzQzZTU5ZjNhNThlMzMwOTY0MDYxIiwiZG0iOjEsImZjIjo4ODA1LCJmbCI6MjQ0NCwia3ciOiJjLGdjYyxjb21waWxhdGlvbixtaW5ndyxvcGVuY2wiLCJudyI6MjIsInBjIjowLCJwciI6MTU2OCwicnQiOjEsInJmIjoiaHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS5oay8iLCJzdCI6ODI3NywidWsiOiI2YWJmNmY2MzBjYmI0N2JhYTZiYmY2ZDI1NjMyZjQxMCIsInpuIjo0NCwidHMiOjEzOTcxMTMxOTI1MjF9&s=o2uZkNa0SH0V3IyZfvbmuwhQa2E)
up vote1down vote | Try changing-l OpenCL to -lOpenCL in the compile line. The -loption of gcc expects the name of the library (without the lib prefix) right next to it without any space. Remember using -lmin school to link to libm?
| ||||||||||||||||||||
|
相关文章推荐
- windows安装rabbitmq报错Error: unable to perform an operation on node ''. Please see diagnostics...
- the virtual machine is in use by an application on your host computer
- Deploy an agent on Windows
- windows安装rabbitmq报错Error: unable to perform an operation on node ''. Please see diagnostics...
- ReportViewer10.0 Windows验证模式下 An error occurred during local report processing.Failed to load expression host assembly
- Resizing an IDE virtual disk on Windows 7 VM
- Installing an SSH Server on Windows 2003
- How to extend an LVM disk on a RHEL guest machine running on VMware host?
- 虚拟机提示the virtual machine is in use by an application on your host computer的解决方案
- Windows下安装RabbitMQ报错:unable to perform an operation on node时的解决方案
- My GCC Environment on Windows Vista
- Changing a forgotten root password on an ESX host
- Unable to install Maven on Windows: “JAVA_HOME is set to an invalid directory”
- How Can I Minimize a VI to an Icon on the Windows System Tray?
- Windows下RabbitMQ报错:Error: unable to perform an operation on node
- Run Vanilla OS X El Capitan, Yosemite or Mavericks in VirtualBox 5.0.10 on a Windows Host
- Custom NAT and DHCP Configuration on a Windows Host
- An easy way to setup a screaming server on Windows
- Windows下安装RabbitMQ报错:unable to perform an operation on node时的解决方案
- Compiling C extension modules on Windows