.cu function call from .c file Linking error encountered

Hello,

I’ve created a project in Microsoft VS 2005 in which there is an “Application.c” file.

There is a .cu file in the project as well. I want that the function of .cu file should be called from the Application.c file, but I’m unable to do that currently.

On building the code, It gives a linking error saying

unresolved external symbol <function name that’s in .cu file> referenced in function main

Some how, I’m not in a position to convert my application in a .cu file… So, by keeping it as .c only, I need to resolve this…

How do I resolve it?

Can I specify LINK ORDER in visual studio? so that I can link .cu file before it links .c file…

Issue resolved using extern “C” option…

Deja-vu. I’ve read this post 3 times in the last minute.

you haven’t get the project settings right so you will meet linking errors

a simple way for you : change the code you want based on the cppIntergration example in SDK . It has been done already for the settings.

Of course, you should also take care of some technical problems such as :

  1. you shouldn’t “include” .cu files in .c or . cpp files. you must use extern “c” to declear functions.
  2. make sure you have already made statements of those functions before use.

read the MatrixMul example in programming guide for more imformation.
Good luck!