PDA

View Full Version : Strange linking problem



Tori
06-10-2011, 07:22 AM
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


#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)*num Platforms);
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:


### 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 :



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 ;) )

pompahpah
06-15-2011, 12:43 PM
Is it important/ critical that (.text+0x93) varies from the next error code?