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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:49:19+00:00 2026-06-13T14:49:19+00:00

I have the following struct to manage Camera State with struct keyState { float

  • 0

I have the following struct to manage Camera State with

 struct keyState
 {
    float x_rotation, y_rotation, z_rotation;
    float x_rotation_rad, y_rotation_rad, z_rotation_rad;
    float x_pos, y_pos, z_pos;
 } state_manager;

This struct is located in my WalkingCameraManipulator.h class. WalkingCameraManipulator is implemented in WalkingCameraManipulator.cpp, and I have an #include “WalkingCameraManipulator” in my main class.

Error 1 error LNK2005: “struct keyState state_manager” (?state_manager@@3UkeyState@@A) already defined in main.obj
Error 2 error LNK1169: one or more multiply defined symbols found

However, I am dealing with the following error message and need to find the best place for my struct. Any ideas on what I can do here? Thanks in advance.

  • 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-06-13T14:49:20+00:00Added an answer on June 13, 2026 at 2:49 pm

    The trailing state_manager defines an instance. In a header. Which is wrong. I suggest you refactor your code as:

    struct keyState
     {
        float x_rotation, y_rotation, z_rotation;
        float x_rotation_rad, y_rotation_rad, z_rotation_rad;
        float x_pos, y_pos, z_pos;
     } ;
    
    extern keyState state_manager;
    
    //somecppfile.cpp
    keyState state_manager;
    

    The extern part is a declaration, and the definition is now in a single implementation file. This mimics your intended behavior, but is probably not what you really want. Do you really want a global instance of keyState? If not, remove it alltogether:

    struct keyState
     {
        float x_rotation, y_rotation, z_rotation;
        float x_rotation_rad, y_rotation_rad, z_rotation_rad;
        float x_pos, y_pos, z_pos;
     } ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have defined the following struct in C: typedef struct point{ float x; float
I have the following struct: struct Records { int Number; char Name[20]; float Salary;
I have following struct to store my vertex data. struct Rz3DContourNode { float x;
I have the following struct private struct sData{ public int volume; public System.Timers.Timer aliveTimer;
I have the following struct: struct Datastore_T { Partition_Datastores_T cmtDatastores; // bytes 0 to
Suppose I have the following: struct Person { std::string mName; Birthday mBirthday; }; using
Let's say we have following code: struct A{ virtual ~A(){} void f(){ p =
Say, I have the following struct in C# : public struct MyStructCSharp { private
I have declared the following struct: typedef struct _RECOGNITIONRESULT { int begin_time_ms, end_time_ms; char*
Suppose I have the following simple struct: struct Vector3 { double x; double y;

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.