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..