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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:45:25+00:00 2026-06-08T00:45:25+00:00

I am working with form application in VC++. I have main form i.e. Form1.h

  • 0

I am working with form application in VC++. I have main form i.e. Form1.h and also the child form named child.h. I am calling the child.h form on the button click of the form1.h. For calling the child.h I have to include Child.h in Form1.h.

I have used the following code
in Form1.h

    #incude "Child.h"

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
     Child^ c=gcnew Child;
     c->Visible=true;
}

And In Child.h I am doing some processing. For this I have made one header file named param.h having some function name and global variables name. I have included param.h in Child.h file.

And param.h is

#ifndef param_h_seen
#define param_h_seen
#define LED_Line 4
#define CALIBRATION_MODE 0
typedef unsigned __int32 uint32_t;
typedef unsigned __int8 uint8_t;

/****for LED ROI entered by user***/
int x_of_roi=6;
int y_of_roi=10;
/********************************/

/*************for graph ROI*******/
int ROIwidth=16;
int ROIheight=4096;

/********************************/
int LED_num= 64;
unsigned short *calib_factor;
/*********functions*****************/

int find_area(unsigned char *intensity,int start);

void DetectRectangle();
/***************************************/


#endif

After Including the child.h It is showing the error

PUMA_LED_TESTER.obj : error LNK2005: "unsigned short * calib_factor" (?calib_factor@@3PAGA) already defined in Child.obj
PUMA_LED_TESTER.obj : error LNK2005: "int x_of_roi" (?x_of_roi@@3HA) already defined in Child.obj
PUMA_LED_TESTER.obj : error LNK2005: "int y_of_roi" (?y_of_roi@@3HA) already defined in Child.obj
PUMA_LED_TESTER.obj : error LNK2005: "int ROIwidth" (?ROIwidth@@3HA) already defined in Child.obj
PUMA_LED_TESTER.obj : error LNK2005: "int ROIheight" (?ROIheight@@3HA) already defined in Child.obj
PUMA_LED_TESTER.obj : error LNK2005: "int LED_num" (?LED_num@@3HA) already defined in Child.obj

I don’t know why these errors are coming.Can any body please tell me the solution to solve these errors

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-08T00:45:28+00:00Added an answer on June 8, 2026 at 12:45 am
    int x_of_roi=6;
    int y_of_roi=10;
    

    Those are definitions, and should not be in your header files. Place them in one of the cpp files, and on the header have:

    extern int x_of_roi
    extern int y_of_roi;
    

    Same goes with the rest of the global variables you declare in your header files. When those headers are included by more than one cpp file (namely translation unit), each unit effectively declares new variables with the same name, which the linker complains about.

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

Sidebar

Related Questions

I have a multi-window application. My main form is a child of the desktop.
I have an application running in JBoss AS6. Authentication is working using the FORM
I am working on an application in which there is one main form and
I have application with two thread. One of them (T1) is main GUI form,
I have a windows form application. On the main form a user will enter
I'm currently working on an application that uses a Windows Form GUI. The main
I'm developing a Windows Form application in C#. I have a main form called
I m working on windows form application. I need to show amount in words
I'm working with a windows form application in C#. I'm using a socket client
I'm working with a windows form application in C#. I'm using a socket client

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.