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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:01:01+00:00 2026-05-14T07:01:01+00:00

I am trying to compile code that works on os x and linux using

  • 0

I am trying to compile code that works on os x and linux using cygwin. However, I am finding that the argument order to gcc gives unanticipated results.

For example, the following fails:

gcc -std=gnu99 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lglib-2.0 -lintl -liconv -fgnu89-inline -fno-leading-underscore -o nb-learn.exe nb-learn.c

but the following works:

gcc -std=gnu99 -fgnu89-inline -fno-leading-underscore -o nb-learn.exe nb-learn.c -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lglib-2.0 -lintl -liconv

Can someone explains how this works? Also, are there techniques or code I can look at for getting autoconf to change the argument order depending on the platform?

Here are the first two lines of the error message:

/cygdrive/c/Users/aischein/AppData/Local/Temp/cc9MvUsf.o:nb-learn.c:(.text+0x260): undefined reference to `_g_hash_table_size'
/cygdrive/c/Users/aischein/AppData/Local/Temp/cc9MvUsf.o:nb-learn.c:(.text+0x29c): undefined reference to `_g_hash_table_get_keys'

Thanks,

SetJmp
(gcc 4.3.4)

  • 1 1 Answer
  • 1 View
  • 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-14T07:01:01+00:00Added an answer on May 14, 2026 at 7:01 am

    GCC documentation says:

    -llibrary

    -l library

    Search the library named library when linking. (The second alternative with the library as a separate argument is only for POSIX compliance and is not recommended.)

    It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified.

    Thus, `foo.o -lz bar.o‘ searches library `z‘ after file foo.o but before bar.o. If bar.o refers to functions in `z‘, those functions may not be loaded.

    -Wl,--start-group and -Wl,--end-group options are useful sometimes for avoiding such problems.

    All this isn’t a problem if you use only shared libraries.

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

Sidebar

Related Questions

I am trying to compile a code that uses Boost's zlib wrappers. However, no
I am trying to compile a code that has a include directory with some
When trying to compile the following code, I am getting a warning that line
When trying to compile this code: #include <iostream> #include <vector> using namespace std; class
I'm trying to compile this code with GCC 4.5.0: #include <algorithm> #include <vector> template
i am trying to compile some code to memory at runtime using a CodeDomProvider.
I am trying to compile my code using libboost library, by putting #include <boost/python.hpp>
I am trying to compile a project using boost and rtmidi. However I keep
I'm trying to compile a program in Ubuntu 11.04 that works well in Windows
I trying to compile this code: Int64 itag = BitConverter.ToInt64(temp, 0); itag &= 0xFFFFFFFFFFFFFC00;

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.