"no instance of function template...matches the argument list"

yes it does.

static_fields.h:

template <typename T> struct vec3         { typedef float   Type; }; // dummy 

template <>           struct vec3<float>  { typedef float3  Type; };

template <>           struct vec3<double> { typedef double3 Type; };

template <typename T> struct vec4         { typedef float   Type; }; // dummy 

template <>           struct vec4<float>  { typedef float4  Type; };

template <>           struct vec4<double> { typedef double4 Type; };

#define T3 typename vec3<T>::Type

#define T4 typename vec4<T>::Type

...

template <typename T>

__device__ T4 apply_static_fields(T4 accel, T4 pos, T4 vel); // <---see, the definition with that arg list is right here!

...

(the code).cu:

#include "static fields.h"

...

template<typename T, bool multithreadBodies>

__global__ void

integrateBodies(T4* newPos, 

                T4* oldPos, 

                T4* vel,

                float deltaTime, float damping, int numBodies) {

...

    T4 position = oldPos[index];   

    T4 velocity = vel[index];   

T4 accel = {0.0f,0.0f,0.0f,0.0f};

    if (!multithreadBodies || (threadIdx.y == 0)) {

 	   accel = apply_static_fields( accel, position, velocity); // <--this is the line that the "error" is on.

...

}

...

template <typename T>

__device__ T4 apply_static_fields(T4 accel, T4 pos, T4 vel) { // <--and here is the actual function!

	accel.w = 0;

...

}

...

what gives?

yes it does.

static_fields.h:

template <typename T> struct vec3         { typedef float   Type; }; // dummy 

template <>           struct vec3<float>  { typedef float3  Type; };

template <>           struct vec3<double> { typedef double3 Type; };

template <typename T> struct vec4         { typedef float   Type; }; // dummy 

template <>           struct vec4<float>  { typedef float4  Type; };

template <>           struct vec4<double> { typedef double4 Type; };

#define T3 typename vec3<T>::Type

#define T4 typename vec4<T>::Type

...

template <typename T>

__device__ T4 apply_static_fields(T4 accel, T4 pos, T4 vel); // <---see, the definition with that arg list is right here!

...

(the code).cu:

#include "static fields.h"

...

template<typename T, bool multithreadBodies>

__global__ void

integrateBodies(T4* newPos, 

                T4* oldPos, 

                T4* vel,

                float deltaTime, float damping, int numBodies) {

...

    T4 position = oldPos[index];   

    T4 velocity = vel[index];   

T4 accel = {0.0f,0.0f,0.0f,0.0f};

    if (!multithreadBodies || (threadIdx.y == 0)) {

 	   accel = apply_static_fields( accel, position, velocity); // <--this is the line that the "error" is on.

...

}

...

template <typename T>

__device__ T4 apply_static_fields(T4 accel, T4 pos, T4 vel) { // <--and here is the actual function!

	accel.w = 0;

...

}

...

what gives?

figured it out.

accel = apply_static_fields( accel, position, velocity); // <--this is the line that the "error" is on.

should be

accel = apply_static_fields<T>( accel, position, velocity); // <--this is the line that the "error" is on.

figured it out.

accel = apply_static_fields( accel, position, velocity); // <--this is the line that the "error" is on.

should be

accel = apply_static_fields<T>( accel, position, velocity); // <--this is the line that the "error" is on.