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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:17:45+00:00 2026-05-28T07:17:45+00:00

I tried many solutions, but can’t get my program work. main.h short NWMP_acc[3]; short

  • 0

I tried many solutions, but can’t get my program work.

main.h

short NWMP_acc[3];
short NWMP_gyro[3];

main.cpp

printf_( "%i,%i,%i, g\n", NWMP_gyro[YAW],NWMP_gyro[PITCH],NWMP_gyro[ROLL]);

other.cpp

#include "main.h"
NWMP_gyro[YAW]   = (((buf[3]>>2)<<8) +  buffer[0]);//multiple definition of `NWMP_gyro'

If I change to “extern short NWMP_acc[3];” than I get an error “undefined reference to `NWMP_acc'”

  • 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-28T07:17:46+00:00Added an answer on May 28, 2026 at 7:17 am

    You need both with and without the extern

    In your header you need:

    extern short NWMP_acc[3];
    extern short NWMP_gyro[3];
    

    But in one of your “.cpp” files you still need:

    short NWMP_acc[3];
    short NWMP_gyro[3];
    

    The reason for this is that the extern keyword can be roughly thought of as meaning “I promise that somewhere in one file there exists an actual real thing that looks like this”.

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

Sidebar

Related Questions

This should be really simple, but I have tried many solutions posted on the
I tried many things but I always get cannot convert string to membershipuser from
I've tried many functions already, but I simply can't figure this out. The right
I've tried many different solutions but none of them are working for me.. I
I've tried many variations of this command: idle.py -e filepath , but it simply
I want to get the page rank for any website. I have tried many
I've tried many different ways of accessing the name of an attribute, but just
I have a problem I tried solving on my own, but didn't get far
I know, this question already been asked in many places repeatedly. But I've tried
I've tried my best to find out a solution with the many script questions

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.