Results 1 to 2 of 2

Thread: Strange linking problem

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    1

    Strange linking problem

    Hello everyone!

    I need your help for a problem that's been tickling my nerves for a few days now...
    I know this problem has been posted many times on many forums but the solutions given to other posts do not work with my case....

    I got a laptop running Win7 64bits.
    I got a RADEON HD 6490M chipset.
    I got the AMD APP SDK 2.4.

    The samples provided with the SDK worked perfectly on Visual Studio 10.0, so I tried to create my own project from scratch and build it with Cygwin :

    vectorAdd.cpp
    Code :
    #include <iostream>
    #include "CL/opencl.h"
    cl_int GetPlatform(cl_platform_id &platform)
    {
    	cl_int err;
    	cl_uint numPlatforms;
     
    	err =clGetPlatformIDs(0, NULL, &numPlatforms);
    	if(err != CL_SUCCESS)
    	{
    		std::cout<<"Error clGetPlatformIDs :"<<err<<std::endl;
    		return 1;
    	}
     
    	if(numPlatforms <= 0)
    	{
    		std::cout<<"No platform found"<<std::endl;
    		return 1;
    	}
     
    	//cl_platform_id* platforms = (cl_platform_id*)malloc(sizeof(cl_platform_id)*numPlatforms);
    	cl_platform_id* platforms = new cl_platform_id[numPlatforms];
    	err = clGetPlatformIDs(numPlatforms, platforms, NULL);
    	if(err != CL_SUCCESS)
    	{
    		std::cout<<"Error clGetPlatformIDs :"<<err<<std::endl;
    		return 1;
    	}
     
    	return 0;
    }
     
    int main(int argc, char* argv[])
    {
    	cl_int err;
    	cl_platform_id platform;
    	err = GetPlatform(platform);
     
    	return err;
    }

    Makefile:
    Code :
    ### Makefile for VectorAdd program
     
    CC=g++
    CFLAGS=-W -Wall -ansi -pedantic
    LDFLAGS=
    OPENCL=/cygdrive/c/Program\ Files\ \(x86\)/AMD\ APP
    INCS =  -I$(OPENCL)/include 
    LIBS = -L$(OPENCL)/lib/x86_64 -lOpenCL
     
    all: vectorAdd.exe
     
    vectorAdd.exe: vectorAdd.o
    	$(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(INCS) -o $@ $^
     
    vectorAdd.o: vectorAdd.cpp
    	$(CC) $(CFLAGS) $(LIBS) $(INCS) -o $@ -c $<
     
    clean:
    	rm *.o
     
    superclean: clean
    	rm vectorAdd.exe

    And here is the error in console output :

    Code :
    vectorAdd.o:vectorAdd.cpp:(.text+0x93): undefined reference to '_clGetPlatformIDs@12'
    vectorAdd.o:vectorAdd.cpp:(.text+0x13d): undefined reference to '_clGetPlatformIDs@12'


    You can see that I DID link OpenCL.lib (64bits), any thoughts?
    I came to conclusion that it cannot be the drivers or other setup as the samples compile and run on visual studio. Maybe the interface with cygwin creates problem?

    Thank you for helping (if you help )

  2. #2
    Junior Member
    Join Date
    Jun 2011
    Posts
    1

    Re: Strange linking problem

    Is it important/ critical that (.text+0x93) varies from the next error code?

Similar Threads

  1. strange array problem
    By katerpillar801 in forum OpenCL
    Replies: 3
    Last Post: 07-19-2011, 10:41 AM

Posting Permissions

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