Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   (Need Help) Codegear Rad Studio C++ Extern Problem ( Unresolved extarnal symbol ) (http://www.go4expert.com/forums/help-codegear-rad-studio-cpp-extern-t29456/)

Skrillex 30Jan2013 12:24

(Need Help) Codegear Rad Studio C++ Extern Problem ( Unresolved extarnal symbol )
 
Hi,

My Problem : If no value is symbol error does not. But I change value is symbol Error found


Error:

Code:


[ILINK32 Error] Error: Unresolved external '_Symbol1' referenced from D:\Test1Project\DEBUG\UNIT1.OBJ
[ILINK32 Error] Error: Unresolved external '_Ex' referenced from D:\Test1Project\DEBUG\UNIT1.OBJ


PublicSymbols.h

Code:


DWORD Symbol1 = 0;

struct mStruct1
        {
                int Lvc;
                int cSnum;
                String Pfq;
                DWORD cID;
        }Ex[25];


Unit1.cpp

Code:



#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"

#include <tchar.h>
#include <windows.h>
#include <math.h>
#include <iostream>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

extern Symbol1;

extern struct mStruct1
        {
                int Lvc;
                int cSnum;
                String Pfq;
                DWORD cID;
        }Ex[25];


__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}

void __fastcall TForm1::FormShow(TObject *Sender)
{
Symbol1 = 300000;
Ex[0].Lvc = 1;
Ex[0].cSnum = 15;
Ex[0].Pfq = "Test";
Ex[0].cID = Ex[0].cSnum * Symbol1;
}
//---------------------------------------------------------------------------

Unit2.cpp

Code:


//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit2.h"

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;

extern Symbol1;

extern struct mStruct1
        {
                int Lvc;
                int cSnum;
                String Pfq;
                DWORD cID;
        }Ex[25];
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
Symbol1 = 600000;
Ex[1].Lvc = 4;
Ex[1].cSnum = 5;
Ex[1].Pfq = "Test5";
Ex[1].cID = Ex[1].cSnum * Symbol1;

}
//---------------------------------------------------------------------------

void __fastcall TForm2::Button2Click(TObject *Sender)
{
ShowMessage((String)Ex[0].Lvc + "\n" + (String)Ex[0].cSnum + "\n" + Ex[0].Pfq + "\n" + (String)Ex[0].cID);
}
//---------------------------------------------------------------------------


Thanks to all messages, Please Help me


All times are GMT +5.5. The time now is 16:28.