cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

roddomi
Journeyman III

alloca: identifier not found

Hi,

I am trying to compile the code from the tutorial "Introductory Tutorial to OpenCL" and I am getting a "alloca: identifier not found" error message from cl.hpp. Don't you have to include malloc.h if you want to use alloca? Adding the include fixes the error.

Thank you,

Rodrigo

0 Likes
5 Replies
brg
Staff
Staff

Which OS are you using?

The problem is I expect down to the fact that "alloca.h" is for some reason not being included in cl.hpp. You should be able to add it before including cl.hpp.

0 Likes

I am using Windows Vista.

0 Likes

Which version of Visual Studio?

Could you try putting the following lines before including cl.hpp:

#include <malloc.h>

#define alloca _alloca

0 Likes

I have Visual Studio 2008.

Most probably adding those two lines would work but why pass the burden to the programmer Wouldn't it be better to modify cl.hpp?

0 Likes

Originally posted by: brg Which OS are you using?

 

The problem is I expect down to the fact that "alloca.h" is for some reason not being included in cl.hpp. You should be able to add it before including cl.hpp.

 

Yes, "alloca.h" isn't included because of the preceeding line:

"#if defined(linux) || defined(__APPLE__) || defined(__MACOSX)"

It seems that the inclusion isn't wanted for WIN32-systems and I think the header also isn't available there.

But adding the two lines helps so far. Is there anyone else who encounters the described problem on Windows systems?

0 Likes