0

I'm trying to compile hello_world.cl from Altera OpenCL SDK

aoc -march=emulator device\hello_world.cl -o bin\hello_world.aocx 

and I ran into this error massage

Creating library libkernel.lib and object libkernel.exp
libkernel.obj : error LNK2019: unresolved external symbol printf referenced in function hello_world
libkernel.dll : fatal error LNK1120: 1 unresolved externals

I found someone having the same problem on Altera Forum: http://www.alteraforum.com/forum/showthread.php?t=46646 I tried everything in the discussion section, (run vcvar64.bat and init_opencl.bat, use echo to check every variable are in place) still can’t resolve the problem.
I know "unresolved external symbol printf" is a simple problem in Visual Studio, but here using aoc I just can't get the library link right...
I tried including <stdio.h> in the .cl code and use aoc -I to link it , doesn't work.
And I don't get why the studio.h in C:\intelFPGA\17.0\hld\include\HLS can be found by the compiler with -I but the one in C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt can't, even with the -I .
I tried the <cstdio> too, but then it ask for more dependencyC:\intelFPGA\17.0\quartus\cusp\synthinclude\stlport\stdio.h:22:11: fatal error: '../include/stdio.h' file not found # include _STLP_NATIVE_C_HEADER(stdio.h).

Any advise is welcome, thanks!


I'm not sure what did he use in 31242820 Seems like he compile it in VS, while I followed the instruction of Altera and use aoc in command prompt, so don't know how to add "additional dependency" here. And the error massage is slightly different..

Matthewyih
  • 11
  • 2
  • `printf()` is supported in OpenCL kernels since OpenCL 1.2. I suspect Altera's OpenCL is older than that. – Joseph Artsimovich May 28 '17 at 12:15
  • 1
    Possible duplicate of [Visual studio 14.0 LNK2001 (unresolved external symbol ) with OpenCL](https://stackoverflow.com/questions/31242820/visual-studio-14-0-lnk2001-unresolved-external-symbol-with-opencl) – doqtor May 28 '17 at 17:56
  • @doqtor Thanks but he was using Visual Studio, I don't think he was targeting a fpga board. – Matthewyih May 30 '17 at 19:05

0 Answers0