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 7158613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:05:44+00:00 2026-05-28T13:05:44+00:00

I have to write some member functions of a class in Assembly for an

  • 0

I have to write some member functions of a class in Assembly for an exam. I’ve followed every instruction but I still can’t get it to work. Here are the relevant files. The header and the main method are already provided, I just need to write the constructor and the elab1 method.

Class header

#include <iostream>
using namespace std;
struct st { int a; int vv1[4]; double vv2[4]; };
class cl 
{   double b; st s;
public:
    cl(int *p, double *d);
    void elab1(st ss);
    void stampa()
    {   int i; cout << b << ' ' << s.a << endl;
        for (i=0;i<4;i++) cout << s.vv1[i] << ' '; cout << '\t';
        for (i=0;i<4;i++) cout << s.vv2[i] << ' '; cout << endl;
        cout << endl;
    }
};

Main method for testing

// prova1.cpp
#include "cc.h" // class header
int main()
{
    st s = {1, 1,2,3,4, 1,2,3,4  };
    int v[4] = {10,11,12,13 };
    double d[4] = { 2, 3, 4, 5 };
    cl cc1(v, d);
    cc1.stampa();
    cc1.elab1(s);
    cc1.stampa();
}

And this is my assembly:

# es1.s
.text
.global __ZN2clC1EPiPe

__ZN2clC1EPiPe:

    pushl %ebp
    movl %esp, %ebp
    subl $4, %esp       

    pushl %eax
    pushl %ebx
    pushl %ecx
    pushl %edx
    pushl %esi

    cmpl $0, 12(%ebp)
    je fine
    cmpl $0, 16(%ebp)
    je fine

    movl 8(%ebp), %eax  
    movl 12(%ebp), %ebx
    movl 4(%ebx), %ecx
    movl %ecx, 12(%eax)

    fldz
    fstpl (%eax)

    movl $0, -4(%ebp)

ciclo:

    cmpl $4, -4(%ebp)
    je fine

    movl -4(%ebp), %esi     
    movl 12(%ebp), %ebx
    movl (%ebx, %esi, 4), %ecx
    subl %esi, %ecx     
    movl %ecx, 16(%eax, %esi, 4)

    movl 16(%ebp), %ebx
    pushl %eax
    movl %esi, %eax
    movl $3, %ecx
    imull %ecx
    movl %eax, %edx
    popl %eax

    movl 12(%ebp), %ecx

    fldl (%ebx, %edx, 4)
    fldl (%ecx, %esi, 4)
    faddp %st, %st(1)

    fstpl 32(%eax, %edx, 4)

    fldl (%ebx, %edx, 4)
    fldl (%eax)
    faddp %st, %st(1)

    fstpl (%eax)

    incl -4(%ebp)
    jmp ciclo

fine:

    popl %esi
    popl %edx
    popl %ecx
    popl %ebx
    popl %eax

    movl 8(%ebp), %eax

    leave
    ret

.global __ZN2cl5elab1E2st

__ZN2cl5elab1E2st: #TODO

I try to compile and link everything with the command-line statement that has been provided to us:

g++ -o es1 -fno-elide-constructors es1.s prova1.cpp

but it only gives me a bunch of undefined references:

/tmp/ccbwS0uN.o: In function `main':
prova1.cpp:(.text+0xee): undefined reference to `cl::cl(int*, double*)'
prova1.cpp:(.text+0x192): undefined reference to `cl::elab1(st)'
collect2: ld returned 1 exit status

Do you have any idea how can I solve this issue? I thought that probably I might have translated the function names in the wrong way, but I’ve checked them several times.

  • 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-05-28T13:05:45+00:00Added an answer on May 28, 2026 at 1:05 pm

    Apply c++filt to your name mangling and compare to the signature in the error message.

    When removing one underscore and filtering with c++filt, I get for your mangled name cl::cl(int*, long double*) which does not match any in your error message/class declaration.

    The correctly mangled name should be _ZN2clC1EPiPd for cl::cl(int*, double*).

    I suggest that you improve the way (wahtever it is) to get the mangled name.

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

Sidebar

Related Questions

I want to write some games, but I don't have any game development experience.
So far I have managed to write some code that should print the source
I have some child processes which should write some logs into a common file.
I have been trying to write some code in Scala to read a file
I have to use windows to write some shell scripts. I decided to use
We have a database app that we're beginning to write some new systems for
I'm trying to write some C# code to do administration on IIS. I have
I need to read and write some data through named pipes. I have tested
I need to write some data in several database. I choose sqlapi.com I have
Question simple and quick: I have started to use Netbeans to write some code

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.