failure on calling cudaBindTexture2D to bind device memory to texture

Hi.I got a cudaError_t when call cudaBindTexture2D() to bind texture to a device memory.
here is the code, I wanted to bin texture to a 2D device memory.

#include "cuda_runtime.h"
#include "device_launch_parameters.h"

#include <stdio.h>
#include <cstdlib>
#include <iostream>
using namespace std;

__host__ void fun(){
	texture<float, 2, cudaReadModeElementType> tex;
	float *float_dev;

	cudaError_t cudaStatus;
	size_t pitch;
	cudaStatus = cudaMallocPitch((void**)&float_dev, &pitch, 100 * sizeof(float), 100);

	cudaChannelFormatDesc desc = cudaCreateChannelDesc<float>();
	size_t offset;
	cudaStatus = cudaBindTexture2D(&offset, &tex, (void*)float_dev, &desc, 100, 100, pitch);

int main()

function cudaBindTexture2D() will return cudaErrorInvalidTexture. I checked the manual, says “cudaErrorInvalidTexture This indicates that the texture passed to the API call is not a valid texture.” is there anything I missed about texture?

My code run on vs2010+cuda4.0, with compiling setting sm_10/arch_10

Thanks in advance.