Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

C++ for OpenCL compile problem

Open
#14 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp, ubuntu
Domain
compilers

Research direction

Reproduce the report using the shown test.cl contents and the clang -cl-std=CLC++ command on Ubuntu with clang 12. Check whether the failure is caused by compilation or linking, then document the supported invocation or limitation. Done means the minimal OpenCL C++ source can be processed without the reported missing-main linker error, or the expected behavior is clearly explained.

Written by the indexing model from the issue text.

Description

My envirment:
Ubuntu clang version 12.0.0-3ubuntu1~20.04.3
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

My problem:
when I do this:
$ echo "kernel void k(){}" > test.cl
$ clang -cl-std=CLC++ ./test.cl

error raises that:
/usr/bin/ld: /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crt1.o: in function _start': (.text+0x24): undefined reference to main'

I wonder how I can solve this problem? I can't even compile the simplest .cl file which supports C++ features. Thanks guys!

Dominant language
CMake
Stars
715
Forks
70
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from KhronosGroup/OpenCL-Guide

All issues in KhronosGroup/OpenCL-Guide

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.