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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:42:11+00:00 2026-05-27T18:42:11+00:00

I am trying to include the World Magnetic Model code, written in C, into

  • 0

I am trying to include the World Magnetic Model code, written in C, into an iOS app. It includes a 8.5M header file that defines a float array with lots of elements. If I include it as is, I get linker errors about duplicate objects, probably because the header is included more than once by different compilation units and the float array is defined in the header file. This is somewhat expected.

I’ve tried splitting that up into a h file and a c file and declaring the float array as extern, but that didn’t work.

Any ideas on how to solve this with as few modifications to the WMM code as possible?

Thanks

EDIT: This is how I tried to split the files up:

// EGM9615.h file
extern float GeoidHeightBuffer[];

// EGM9615.c file
#include "EGM9615.h"

float GeoidHeightBuffer[] =
{1.2, 1.2, // lots more
};

It results in linker errors still:

Undefined symbols for architecture armv7:
“__Z29WMM_TimelyModifyMagneticModel12WMMtype_DateP21WMMtype_MagneticModelS1_”,
referenced from:
-[Waypoint magneticVariation] in Waypoint.o “__Z23WMM_GeodeticToSpherical17WMMtype_Ellipsoid21WMMtype_CoordGeodeticP22WMMtype_CoordSpherical”,
referenced from:
-[Waypoint magneticVariation] in Waypoint.o “__Z26WMM_CalculateGridVariation21WMMtype_CoordGeodeticP27WMMtype_GeoMagneticElements”,
referenced from:
-[Waypoint magneticVariation] in Waypoint.o “__Z10WMM_Geomag17WMMtype_Ellipsoid22WMMtype_CoordSpherical21WMMtype_CoordGeodeticP21WMMtype_MagneticModelP27WMMtype_GeoMagneticElements”, referenced from:
-[Waypoint magneticVariation] in Waypoint.o “__Z23WMM_AllocateModelMemoryi”, referenced from:
-[Waypoint magneticVariation] in Waypoint.o “__Z22WMM_GeomagIntroductionP21WMMtype_MagneticModelPc”, referenced
from:
-[Waypoint magneticVariation] in Waypoint.o “__Z23WMM_robustReadMagModelsPcPP21WMMtype_MagneticModeli”, referenced
from:
-[Waypoint magneticVariation] in Waypoint.o “__Z9WMM_Errori”, referenced from:
-[Waypoint magneticVariation] in Waypoint.o “__Z15WMM_SetDefaultsP17WMMtype_EllipsoidP21WMMtype_MagneticModelP13WMMtype_Geoid”,
referenced from:
-[Waypoint magneticVariation] in Waypoint.o ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with
exit code 1 (use -v to see invocation)

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

    I’ve tried splitting that up into a h file and a c file and declaring the float array as extern, but that didn’t work.

    Then you did this incorrectly. This is the correct way to solve your problem. Take another look at what errors you saw when you split it up this way.

    I am assuming here that when you say “duplicate objects” you mean duplicate identifiers at link time, not “objects.”


    EDIT: Your failed symbols have nothing to do with GeoidHeightBuffer. It looks like you’re not linking whatever code provides WMM_TimelyModifyMagneticModel() and its friends. These appear to be C++ name-mangled. Are you compiling C code with a C++ compiler without using extern "C" {}?

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

Sidebar

Related Questions

I am trying to include a .js file into a php file. My folder
I'm trying to build a hello world using GTK, which includes the line: #include
I'm trying to build an .exe file for the K&R Hello, world. The code
When trying to compile with Code::Blocks the example that comes up with GTK+: #include
I am trying to compile some C++ code that uses threads: #include <iostream> #include
I'm trying to include an EPS figure in a document that will be compiled
I am trying to include the Zend_Service_Amazon_S3 file by using require_once 'Zend/Service/Amazon/S3.php'; I have
I am trying to include the library StringEscapeUtils and everything that I can find
I am trying to include a variable in a .ini file setting by surrounding
Hi I am trying to include a perl script within my shtml file. Unfortunately

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.