Reference in headers are not recognized properly

Hi, I just get the TX1 board yesterday and I am trying to get access to GPIO. I found a GPIO code at https://github.com/jetsonhacks/jetsonGPIO, and I am trying to include that in my project. But error like below occurs if I use any function in side the header.

./src/runtime-cuda.o: In function `main':
/home/ubuntu/Documents/runtime-cuda/Debug/../src/runtime-cuda.cu:92: undefined reference to `gpioExport(unsigned int)'

And I think the compiler does find the header, because I can use enum, define, variables, anything except functions. Can any body give me some idea about this?
PS: I am using the Nsight provided in newest Jetpack, and I add the header and source file into sample guide codes in Real time cuda which works fine if I do not use functions in headers

Also can I use visual studio as the compiler? I do see there is a Nsight for VS but I am not sure how to get it into cross compile mode.

Thx!!

Update:
I copied all definition from cpp file to the hpp file now it works. But I still don’t understand why I can’t put my definition in cpp file I do included the header where functions are declared in the cpp

Consider that the compiler only understands building one piece of code which it can see completely…if another piece of code is referenced, then the other previously compiled piece of code must be linked (those are the two basic stages…compiling pieces, and then linking…linking was missing).

You could post the Makefile to see how linking is set up (and/or a log of the build).

Thx linuxdev,
I tried to creat another cpp and hpp file and past all code in without any change, and it works now. It might because the linker’s problem.

And do you know if we can use visual studio as the IDE or not? if we can how can I set it up?

I am only aware of using the Nsight edition of Eclipse. I suppose if cross compilers (ARMV8-a and ARMv8) are available which Visual Studio can use then it could act as a front end.