Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8780701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:07:27+00:00 2026-06-13T20:07:27+00:00

I successfully created an operator+ between two float4 by doing : __device__ float4 operator+(float4

  • 0

I successfully created an operator+ between two float4 by doing :

__device__ float4 operator+(float4 a, float4 b) {
 // ...
}

However, if in addition, I want to have an operator+ for uchar4, by doing the same thing with uchar4, i get the following error:
“error: more than one instance of overloaded function “operator+” has “C” linkage” “

I get a similar error message when I declare multiple functions with the same name but different arguments.
So, two questions :

  • Polymorphism : Is-it possible to have multiple functions with the same name and different arguments in Cuda ? If so, why do I have this error message ?
  • operator+ for float4 : it seems that this feature is already included by including “cutil_math.h”, but when I include that (#include <cutil_math.h>) it complains that there is no such file or directory… anything particular I should do ? Note: I am using pycuda, which is a cuda for python.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:07:28+00:00Added an answer on June 13, 2026 at 8:07 pm

    Note the “has “C” linkage” in the error. You are compiling your code with C linkage (pyCUDA does this by default to circumvent symbol mangling issues). C++ can’t support multiple definitions of the same function name using C linkage.

    The solution is to compile code without automatically generated “extern C”, and explicitly specify C linkage only for kernels. So your code would looks something like:

    __device__ float4 operator+(float4 a, float4 b) { ... };
    
    extern "C"
    __global__ void kernel() { };
    

    rather than the standard pyCUDA emitted:

    extern "C" 
    {
         __device__ float4 operator+(float4 a, float4 b) { ... };
    
         __global__ void kernel() { };
    }
    

    pycuda.compiler.SourceModule has an option no_extern_c which can be used to control whether extern "C" is emitted by the just in time compilation system or not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have successfully created an application which is workable on the >3.0 devices. However,
I have successfully created Web Services from MySQL Database using Netbeans tutorial . However,
I have successfully created my first django project. I have two apps in my
I have successfully created a feature in sharepoint that modifies the existing edit dialog
I've successfully created a WCF service that works how I want it to. The
I have successfully created a custom Facebook open graph action, and have been able
i have successfully created distribution profiles and installed on my xcode organiser, but this
I have successfully created an app that reads from a bundled .plist file and
I am creating a widget and had successfully created it, what I want to
I successfully created the Database and inserted a row however I cannot Query it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.