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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:00:38+00:00 2026-05-31T18:00:38+00:00

(Running MingW on 64-bit Windows 7 and the GCC on Kubuntu) This may possibly

  • 0

(Running MingW on 64-bit Windows 7 and the GCC on Kubuntu)

This may possibly be just a MingW problem, but it’s failed on at least one Kubuntu installation as well, so I’m doubtful.

I have a short, simple C program, which is supposed to call an assembly function. I compile the assembler using nasm and the c program using MingW’s implementation of the gcc. The two are linked together with a makefile – bog-simple. And yet, linkage fails on the claim the claim that the external function is an ‘undefined reference’

Relevant part of the makefile:

assign0: ass0.o main.o 
gcc -v -m32 -g -Wall -o assign0 ass0.o main.o 


    main.o: main.c 
         gcc -g -c -Wall -m32 -o main.o main.c 

    ass0.o: ass0.s
     nasm -g -f elf -w+all -o ass0.o ass0.s

The beginning of the assembly file:

section .data                       ; data section, read-write
    an:    DD 0                 ; this is a temporary var

section .text                       ; our code is always in the .text section
    global do_str               ; makes the function appear in global scope
    extern printf               

do_str:                             ; functions are defined as labels
[Just Code]

And the c file’s declaration:

extern int do_str(char* a);

This has worked on at least one Kubuntu installation, failed on another, and failed on MingW. Does anyone have an idea?

  • 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-31T18:00:39+00:00Added an answer on May 31, 2026 at 6:00 pm

    C compilers may call the actual “function” differently, e.g. _do_str instead of do_str. Name mangling not happening always could depends on the system (and of course on the compiler). Try calling the asm function _do_str. Using proper attributes (in gcc) could also fix the problem. Also read this.

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

Sidebar

Related Questions

I am running bash scripts on windows using a msys and mingw environment. I
So, I'm just trying to build pywin32 on my Windows 7 machine. When running
I'm running Windows Server 2003 on a 64-bit Itanium server which is also running
I’m using the gcc in MinGW that comes with Strawberry Perl, on Windows XP.
I'm running the latest cygwin on windows 7 (32-bit), and trying to build an
I m using MinGW for running g++ compiler on windows. Whenever I run the
I'm on Windows, running GDB on an executable built under MinGW. The program has
Running this program is printing forked! 7 times. Can someone explain how forked! is
Running the following program on gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 and Intel(R) Core(TM)2 Duo CPU,
I am building TBB under MinGW32 (on Windows 7 64 bit) and linking a

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.