OpenCL : invalid operands to binary expression

Hi,
What version of clang are you using? And what options are you passing?

Sam

Sam Parker
Research Student
Electronic Systems Design Group
School of Electronic, Electrical and Systems Engineering
Loughborough University

Hi Sam,
       I am using clang3.4 version.
My makefile is

CXX := clang++
LLVMCOMPONENTS := cppbackend
RTTIFLAG := -fno-rtti
LLVMCONFIG := /sandbox/xiuxia/llvm_build/Debug+Asserts/bin/llvm-config

CXXFLAGS := -I$(shell $(LLVMCONFIG) --src-root)/tools/clang/include
-I$(shell $(LLVMCONFIG) --obj-root)/tools/clang/include $(shell
$(LLVMCONFIG) --cxxflags) $(RTTIFLAG)
LLVMLDFLAGS := $(shell $(LLVMCONFIG) --ldflags --libs $(LLVMCOMPONENTS))

SOURCES = CI_opencl.cpp

OBJECTS = $(SOURCES:.cpp=.o)
EXES = $(OBJECTS:.o=)
CLANGLIBS = \
                -lclangTooling\
                -lclangFrontendTool\
                -lclangFrontend\
                -lclangDriver\
                -lclangSerialization\
                -lclangCodeGen\
                -lclangParse\
                -lclangSema\
                -lclangStaticAnalyzerFrontend\
                -lclangStaticAnalyzerCheckers\
                -lclangStaticAnalyzerCore\
                -lclangAnalysis\
                -lclangARCMigrate\
                -lclangRewriteFrontend\
                -lclangRewriteCore\
                -lclangEdit\
                -lclangAST\
                -lclangLex\
                -lclangBasic\
                $(shell $(LLVMCONFIG) --libs)\
                -lcurses

all: $(OBJECTS) $(EXES)

%: %.o
    $(CXX) -o $@ $< $(CLANGLIBS) $(LLVMLDFLAGS)

Here is my source file : I put it on the attachment. CI_opencl.cpp
<http://clang-developers.42468.n3.nabble.com/file/n4038913/CI_opencl.cpp&gt;

Hi,

Ok, I though you were just trying to compile on the command line...
Haven't checked this, but something along like this should work:

Invocation->setLangDefaults(langOpts,
                              clang::IK_CXX, // change to clang::IK_OpenCL
                              clang::LangStandard::lang_opencl);

And grab the opencl header files from libclc.llvm.org and add these to your search path:
hso->AddPath("/path/to/libclc/headers", clang::frontend::Angled, false, false);

and you'll also have to enable the storage classes:
ci.getPreprocessorOpts().addMacroDef("cl_clang_storage_class_specifiers");

good luck,
Sam

Sam Parker
Research Student
Electronic Systems Design Group
Loughborough University
UK