Results 1 to 2 of 2

Thread: Getting undefined reference Errors

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    1

    Getting undefined reference Errors

    Hi
    I am trying to run the Opencl version of kmeans but getting some linking errors while running.

    kmeans_clustering.o: In function `kmeans_clustering':
    kmeans_clustering.c.text+0x7d2): undefined reference to `clCreateBuffer'
    kmeans_clustering.c.text+0x814): undefined reference to `clCreateBuffer'
    kmeans_clustering.c.text+0x85a): undefined reference to `clCreateBuffer'
    kmeans_clustering.c.text+0x88f): undefined reference to `clSetKernelArg'
    kmeans_clustering.c.text+0x8b0): undefined reference to `clSetKernelArg'
    kmeans_clustering.c.text+0x8d1): undefined reference to `clSetKernelArg'
    kmeans_clustering.c.text+0x8f1): undefined reference to `clSetKernelArg'
    kmeans_clustering.c.text+0x911): undefined reference to `clSetKernelArg'
    kmeans_clustering.o:kmeans_clustering.c.text+0x931): more undefined references to `clSetKernelArg' follow
    kmeans_clustering.o: In function `kmeans_clustering':
    kmeans_clustering.c.text+0xbb6): undefined reference to `clEnqueueNDRangeKernel


    This is my Makefile


    OPENCL_OPTS = -I ~/NVIDIA_GPU_Computing_SDK/OpenCL/common/inc/ -L ~/NVIDIA_GPU_Computing_SDK/OpenCL/common/lib/ -l OpenCL

    DFLAGS = -D_USE_ATOMIC_PRAGMA_
    DFLAGS =

    OPTFLAGS = -O2
    INCFLAGS =
    CFLAGS = $(OPENCL_OPTS) $(OPTFLAGS) $(DFLAGS) $(INCFLAGS) -pg
    LDFLAGS = -lm -pg

    # CC = cc -g -non_shared -taso -DANSI -D__STDC__
    CC = gcc
    # CC = icc -openmp

    H_FILES = fuzzy_kmeans.h

    SRC = fuzzy_kmeans.c \
    cluster.c \
    kmeans_clustering.c \
    example.c

    OBJ = $(SRC:%.c=%.o)

    .c.o:
    $(CC) $(CFLAGS) -c $<

    all: example

    example: $(OBJ) $(H_FILES)
    $(CC) $(OPTFLAGS) -o example $(OBJ) $(LDFLAGS)

    Please someone help me..

  2. #2
    Senior Member
    Join Date
    Aug 2011
    Posts
    271

    Re: Getting undefined reference Errors

    this stuff is for the linker:
    -L ~/NVIDIA_GPU_Computing_SDK/OpenCL/common/lib/ -l OpenCL

    It needs to go into LDFLAGS, not CFLAGS.

Similar Threads

  1. Replies: 9
    Last Post: 01-11-2011, 03:20 PM
  2. Errors, errors, and more errors..the kicker->theyre Run-t
    By Alaric in forum OpenGL ES general technical discussions
    Replies: 0
    Last Post: 11-09-2005, 10:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •