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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:42:30+00:00 2026-05-13T05:42:30+00:00

I’m trying to learn assembly using NASM, the pcasm-book.pdf from Dr Paul Carter –

  • 0

I’m trying to learn assembly using NASM, the pcasm-book.pdf from Dr Paul Carter – http://www.drpaulcarter.com/pcasm/ – on my Mac OS X Snow Leopard.

I’m trying to link the previous compiled C sample to asm samples:

gcc first.o driver.c asm_io.o -o first

But it’s returning it:

driver.c:3: warning: ‘cdecl’ attribute ignored
ld: warning: in first.o, **file is not of required architecture**
ld: warning: in asm_io.o, file is not of required architecture
Undefined symbols:
  "_asm_main", referenced from:
      _main in ccjLqYJn.o
ld: symbol(s) not found

I’m using the Mach-o format to compile asm samples, and I got no errors:

nasm -f macho **first.asm**
nasm -f macho asm_io.asm

If I try to use only gcc -c in driver.c, using ld to link all object files, ld appears to not link driver.o format.

ld -o first asm_io.o first.o driver.o

It returns:

ld: warning: in driver.o, file is not of required architecture
Undefined symbols:
  "_putchar", referenced from:
      print_char in asm_io.o
      print_nl in asm_io.o
  "_printf", referenced from:
      print_int in asm_io.o
      print_string in asm_io.o
      push_of in asm_io.o
      sub_dump_stack in asm_io.o
      stack_line_loop in asm_io.o
      sub_dump_mem in asm_io.o
      mem_outer_loop in asm_io.o
      mem_hex_loop in asm_io.o
      sub_dump_math in asm_io.o
      tag_loop in asm_io.o
      print_real in asm_io.o
      invalid_st in asm_io.o
  "_scanf", referenced from:
      read_int in asm_io.o
  "_getchar", referenced from:
      read_char in asm_io.o
ld: symbol(s) not found for inferred architecture i386

What’s the problem? What is the correct format to work with gcc and NASM on OS X?

Thank you.
Daniel Koch

  • 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-13T05:42:30+00:00Added an answer on May 13, 2026 at 5:42 am

    The “file is not of required architecture” indicates that you’re trying to link object files with different architectures: probably x86_64 and i386. As it appears your nasm output is i386, try using -arch i386 with gcc. You can also use file to display the architecture of a given object file or library.

    % touch foo.c ; gcc -c foo.c
    % file foo.o
    foo.o: Mach-O 64-bit object x86_64
    % gcc -c -arch i386 foo.c
    % file foo.o             
    foo.o: Mach-O object i386
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 319k
  • Answers 319k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer POSTing data to an URL can be done with the… May 14, 2026 at 12:13 am
  • Editorial Team
    Editorial Team added an answer Do you mean syntax highlighting? Syntax generation in PHP is… May 14, 2026 at 12:13 am
  • Editorial Team
    Editorial Team added an answer You can raise the bar using javascript, but anything a… May 14, 2026 at 12:13 am

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want use html5's new tag to play a wav file (currently only supported
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I've got a string that has curly quotes in it. I'd like to replace
In order to apply a triggered animation to all ToolTip s in my app,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.