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

  • SEARCH
  • Home
  • 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 8676229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:08:30+00:00 2026-06-12T20:08:30+00:00

I converted a C++ code to C and now I’m trying to change the

  • 0

I converted a C++ code to C and now I’m trying to change the Makefile as well. I had this:

g++ -fPIC -o bin/linux/release/gpu_md5 cuda_md5.c cuda_md5_cpu.c obj/release/cuda_md5_gpu.cu.o 
-L/usr/local/cuda/lib64 -L../../lib64 
-L../../common/lib64/linux -L/opt/cuda/NVIDIA_CUDA_SDK/lib64 -lcudart     
-L/usr/local/cuda/lib64 -L../../lib64 
-L../../common/lib64/linux -L/opt/cuda/NVIDIA_CUDA_SDK/lib64

As far as I know I could just change g++ to gcc and it should work well, but it is not. Looks like gcc can’t find the functions from cuda_md5_cpu.c that I’m calling in cuda_md5.c (PS: I’m not including cuda_md5_cpu.c in cuda_md5.c):

/tmp/ccKdDJiq.o: In function `cuda_compute_md5s':
cuda_md5.c:(.text+0x201): undefined reference to `init_constants'
cuda_md5.c:(.text+0x2e2): undefined reference to `execute_kernel'
collect2: ld returned 1 exit status

What is wrong? I just changed from g++ to gcc.

  • 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-12T20:08:31+00:00Added an answer on June 12, 2026 at 8:08 pm

    I would say there’s a very good chance that obj/release/cuda_md5_gpu.cu.o (which you don’t seem to be recompiling) has been compiled with a C++ compiler and therefore has symbol names which have been modified by name mangling.

    Name mangling is a technique used by C++ compilers to allow different functions to have the same name but with different parameter types (overloading), and C compilers have no need to do this since there is no overloading allowed.

    In other words, you may find that init_constants(int,float); may simply be morphed by a C compiler into _init_constants but, if you use a C++ compiler, you’ll get something like _init_constants_$$_IntFloat so as to distinguish it from init_constants(int,double) or init_constants(void).

    So a linker that tries to link together a C-compiled cuda_md5.c with a C++-compiled obj/release/cuda_md5_gpu.cu.o will not be able to match the function names together.

    That’s often why you see extern "C" { ... } in C++ code, it uses the C rules to export function names (and other things) to the linker to allow linking of C and C++ code together.

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

Sidebar

Related Questions

How is this C code converted to delphi? static unsigned char tempbuf[128*1024]; Thanks
So I have this code here, that (for now) just turns a base1 number
I just converted a code snippet from VB.NET to C# and stumbled over this
right now this code works for tomorrow and next month - weekend use to
(EDIT: This question is now outdated for my particular issue, as Google Code supports
I've converted a public property as public variable to make code simpler and now
I just converted a website from Foxpro to asp.Net with VB. I'm now trying
I'm trying to parse strings that represent source code, something like this: [code lang=html]
I have these code which I have converted from Java. Now I need to
What started as a simple validation code converted in something very paradoxical in my

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.