Custom Control compilation failures

Source: Internet
Author: User

When creating a custom class, an error is reported during compilation in vc6.

Error Message

Deleting intermediate files and output files for project 'test3-Win32 Uni debug '.
------------------ Configuration: TEST3-Win32 Uni Debug --------------------
Building resources from Test3_caption.rss
Perl-S epocrc_ide6.pl-I "\ WORK \ TEST3 \ DATA"-I "\ WORK \ TEST3 \ GROUP"-I "\ WORK \ TEST3 \ INC"-I" \ WORK \ TEST3 \ GROUP "-I" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ INCLUDE "-DLANGUAGE_ SC-u" \ WORK \ TEST3 \ DATA \ Test3_caption.rss "-o" \ Symbian \ 8.0a \ S60_2nd_FP2 _
SC \ EPOC32 \ RELEASE \ WINS \ UDEB \ Z \ SYSTEM \ APPS \ TEST3 \ TEST3_CAPTION.rSC "-h" \ WORK \ TEST3 \ DATA \ TEST3_CAPTION.rs ~ "-T" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ BUILD \ WORK \ TEST3 \ GROUP \ TEST3 \ WINS \ UDEB"
Echo this is a dummy output file> "\ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ RELEASE \ WINS \ UDEB \ Z \ SYSTEM \ APPS \ TEST3 \ TEST3_CAPTION.rSC.dummy"
Perl-S ecopyfile. pl "\ WORK \ TEST3 \ DATA \ TEST3_CAPTION.rs ~ "" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ INCLUDE \ TEST3_CAPTION.RSG"
Del "\ WORK \ TEST3 \ DATA \ TEST3_CAPTION.rs ~ "
Building resources from Test3.rss
Perl-S epocrc_ide6.pl-I "\ WORK \ TEST3 \ DATA"-I "\ WORK \ TEST3 \ GROUP"-I "\ WORK \ TEST3 \ INC"-I" \ WORK \ TEST3 \ GROUP "-I" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ INCLUDE "-DLANGUAGE_ SC-u" \ WORK \ TEST3 \ DATA \ Test3.rss "-o" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC3
2 \ RELEASE \ WINS \ UDEB \ Z \ SYSTEM \ APPS \ TEST3 \ TEST3.rSC "-h" \ WORK \ TEST3 \ DATA \ TEST3.rs ~ "-T" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ BUILD \ WORK \ TEST3 \ GROUP \ TEST3 \ WINS \ UDEB"
Echo this is a dummy output file> "\ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ RELEASE \ WINS \ UDEB \ Z \ SYSTEM \ APPS \ TEST3 \ TEST3.rSC. dummy"
Perl-S ecopyfile. pl "\ WORK \ TEST3 \ DATA \ TEST3.rs ~ "" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ INCLUDE \ TEST3.RSG"
Del "\ WORK \ TEST3 \ DATA \ TEST3.rs ~ "
Compiling...
Test3.uid. cpp
Test3app. cpp
Test3appui. cpp
Test3container. cpp
Test3document. cpp
SimpleControl. cpp
C: \ Work \ Test3 \ src \ SimpleControl. cpp (39): warning C4100: 'atype ': unreferenced formal parameter
C: \ Work \ Test3 \ src \ SimpleControl. cpp (39): warning C4100: 'akeyevent': unreferenced formal parameter
Generating Code...
Doing first-stage link by name
Link.exe @ C: \ Users \ zziss \ AppData \ Local \ Temp \ nma03676.
Creating library \ Symbian \ 8.0a \ Users \ EPOC32 \ BUILD \ WORK \ TEST3 \ GROUP \ TEST3 \ WINS \ UDEB \ TEST3.lib and object \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ BUILD \ WORK \ TEST3 \ GROUP \ TEST3 \ WINS \ UDEB \ TEST3.exp
TEST3CONTAINER. obj: error LNK2001: unresolved external symbol "public: static class CSimpleControl * _ cdecl CSimpleControl: NewLC (class TRect const &)"(? NewLC @ CSimpleControl @ SAPAV1 @ ABVTRect @ Z)
\ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ BUILD \ WORK \ TEST3 \ GROUP \ TEST3 \ WINS \ UDEB \ TEST3.APP: fatal error LNK1120: 1 unresolved externals
NMAKE: fatal error U1077: 'link.exe ': return code '0x460'
Stop.
If exist "\ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ BUILD \ WORK \ TEST3 \ GROUP \ TEST3 \ WINS \ UDEB \ TEST3.exp" del "\ Symbian \ 8.0a \ release \ EPOC32 \ BUILD \ WORK \ TEST3 \ GROUP \ TEST3 \ WINS \ UDEB \ TEST3.exp"
Stopped the build by removing the export object,
If present, because the pre-link stage failed
Linking...
LINK: fatal error LNK1104: cannot open file "\ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ BUILD \ WORK \ TEST3 \ GROUP \ TEST3 \ WINS \ UDEB \ TEST3.exp"
An error occurred while executing link.exe. TEST3.APP-1 error (s), 0 warning (s)

In fact, this error message is mainly public: static class CSimpleControl * _ cdecl CSimpleControl: NewLC (class TRect const &)"

This project is generated through appWizard, and all operations are performed by default.

Then I finally found a solution to this problem.

1. during production, do not Generate the dsw file of the project to the same location as the mmp file, that is, select the second "Generate files to epoc32 \ build folder" in the last step of the wizard"

2. After the files are generated, bldmake bldfiles and abld makefiles vc6 are used to generate a workspace file,

3. Add a class. Note: When adding a class, check whether the path of the header file and code file is correct (the header file is in the inc directory and the code file is in the src directory)

4. Edit the mmp file and add the cpp file of this class to source.

5. Reference this control to the container class.

6. The above error message will be reported during compilation.

7. Go to the epoc32 \ build directory to delete the project file directory.

8. Repeat the bld file and the abld vc6 project file.

9. Open the project again, compile it, and there is no error

I don't know where this error is caused, nor can I find it.

My questions on this issue on the Forum

I did a simple exercise and used the app Wizard to generate a project.
Then add a class
Header file Code:
#include <coecntrl.h>class CSimpleControl : public CCoeControl  {public:static CSimpleControl* NewLC(const TRect& aRect);static CSimpleControl* NewL(const TRect& aRect);void SizeChanged();void ConstructL(const TRect& aRect);CSimpleControl();virtual ~CSimpleControl();TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);TInt CountComponentControls() const;private:void Draw(const TRect &aRect) const;};

Implementation Code:

CSimpleControl::CSimpleControl(){}CSimpleControl::~CSimpleControl(){}void CSimpleControl::ConstructL(const TRect &aRect){CreateWindowL();SetRect(aRect);ActivateL();}void CSimpleControl::Draw(const TRect &aRect) const{CWindowGc& gc = SystemGc();gc.SetPenStyle(CGraphicsContext::ENullPen);gc.SetPenColor(KRgbRed);gc.SetBrushColor(KRgbDarkBlue);gc.SetBrushStyle(CGraphicsContext::ESolidBrush);gc.DrawRect(aRect);}TKeyResponse CSimpleControl::OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType){return EKeyWasNotConsumed;}void CSimpleControl::SizeChanged(){}TInt CSimpleControl::CountComponentControls() const{return 1;}CSimpleControl* CSimpleControl::NewLC(const TRect &aRect){CSimpleControl* self = new (ELeave) CSimpleControl();CleanupStack::PushL(self);self->ConstructL(aRect);return self;}CSimpleControl* CSimpleControl::NewL( const TRect& aRect ){CSimpleControl* self = CSimpleControl::NewLC(aRect);CleanupStack::Pop(self);return self;}

Call in CSimpleContainer

Defined as Code:

private: //data                CEikLabel* iLabel;          // example label        CEikLabel* iToDoLabel;      // example labelCSimpleControl* iSimple;    };

Create an instance in constructL Code:

void CSimpleContainer::ConstructL(const TRect& aRect)    {    CreateWindowL();    iLabel = new (ELeave) CEikLabel;    iLabel->SetContainerWindowL( *this );    iLabel->SetTextL( _L("Example View") );    iToDoLabel = new (ELeave) CEikLabel;    iToDoLabel->SetContainerWindowL( *this );    iToDoLabel->SetTextL( _L("Add Your controls\n here") );iSimple = CSimpleControl::NewLC(aRect);iSimple->SetContainerWindowL(*this);    SetRect(aRect);    ActivateL();    }

The above iSimple = CSimpleControl: NewLC (aRect); I switched to iSimple = new (ELeave) Simple (); neither can I.
Error Message

Code:
Deleting intermediate files and output files for project 'simple-Win32 Uni debug '. -------------------- Configuration: SIMPLE-Win32 Uni Debug ------------------ Building resources from Simple_caption.rss perl-S epocrc_ide6.pl-I "\ WORK \ SIMPLE \ DATA"-I "\ WORK \ SIMPLE \ GROUP"-I "\ WORK \ SIMPLE \ INC "-I" \ WORK \ SIMPLE \ GROUP "-I" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ INCLUDE "-DLANGUAGE_ SC-u" \ WORK \ SI MPLE \ DATA \ Simple_caption.rss "-o" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ RELEASE \ WINS \ UDEB \ Z \ SYSTEM \ APPS \ SIMPLE \ SIMPLE_CAPTION.rSC "-h" \ WORK \ SIMPLE \ DATA \ SIMPLE_CAPTION.rs ~ "-T" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ BUILD \ WORK \ SIMPLE \ GROUP \ SIMPLE \ WINS \ UDEB "echo this is a dummy output file>" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ RELEASE \ WINS \ UDEB \ Z \ SYSTEM \ APPS \ SIMPLE \ SIMPLE_CAPTION.rSC.dummy "perl-S ecopyfile. pl "\ WORK \ SIMPLE \ DATA \ SIMPLE_CAPTION.rs ~ "" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ INCLUDE \ SIMPLE_CAPTION.RSG "del" \ WORK \ SIMPLE \ DATA \ SIMPLE_CAPTION.rs ~ "Building resources from Simple. rss perl-S epocrc_ide6.pl-I "\ WORK \ SIMPLE \ DATA"-I "\ WORK \ SIMPLE \ GROUP"-I "\ WORK \ SIMPLE \ INC"-I "\ WORK \ SIMPLE \ GROUP"-I "\ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ INCLUDE"-DLANGUAGE_ SC-u "\ WORK \ SIMPLE \ DATA \ Simple. rss "-o" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ RELEASE \ WINS \ UDEB \ Z \ SYSTEM \ APPS \ SIMPLE. rSC "-h" \ WORK \ SIMPLE \ DATA \ SIMPLE. rs ~ "-T" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ BUILD \ WORK \ SIMPLE \ GROUP \ SIMPLE \ WINS \ UDEB "echo this is a dummy output file>" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ RELEASE \ WINS \ UDEB \ Z \ SYSTEM \ APPS \ SIMPLE. rSC. dummy "perl-S ecopyfile. pl "\ WORK \ SIMPLE \ DATA \ SIMPLE. rs ~ "" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ INCLUDE \ SIMPLE. RSG "del" \ WORK \ SIMPLE \ DATA \ SIMPLE. rs ~ "Compiling... simple. uid. cppSimpleapp. cppSimpleappui. cppSimplecontainer. cppSimpleControl. cppC: \ Work \ Simple \ group \ SimpleControl. cpp (39): warning C4100: 'atype ': unreferenced formal parameterC: \ Work \ Simple \ group \ SimpleControl. cpp (39): warning C4100: 'akeyevent': unreferenced formal parameterSimpledocument. cppGenerating Code... doing first-stage link by name link.exe @ C: \ release E ~ 1 \ QIJIAN ~ 1 \ LOCALS ~ 1 \ Temp \ nma05404. Creating library \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ BUILD \ WORK \ SIMPLE \ GROUP \ SIMPLE \ WINS \ UDEB \ SIMPLE. lib and object \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ BUILD \ WORK \ SIMPLE \ GROUP \ SIMPLE \ WINS \ UDEB \ SIMPLE. expSIMPLECONTAINER. obj: error LNK2001: unresolved external symbol "public: static class CSimpleControl * _ cdecl CSimpleControl: NewLC (class TRect const &)"(? NewLC @ CSimpleControl @ SAPAV1 @ ABVTRect @ Z) \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ BUILD \ WORK \ SIMPLE \ GROUP \ SIMPLE \ WINS \ UDEB \ SIMPLE. APP: fatal error LNK1120: 1 unresolved externalsNMAKE: fatal error U1077: 'link.exe ': return code '0x460' Stop. if exist "\ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ BUILD \ WORK \ SIMPLE \ GROUP \ SIMPLE \ WINS \ UDEB \ SIMPLE. exp "del" \ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ BUILD \ WORK \ SIMPLE \ GROUP \ SIMPLE \ WINS \ UDEB \ SIMPLE. exp "Stopped the build by removing the export object, if present, because the pre-link stage failedLinking... LINK: fatal error LNK1104: cannot open file "\ Symbian \ 8.0a \ S60_2nd_FP2_ SC \ EPOC32 \ BUILD \ WORK \ SIMPLE \ GROUP \ SIMPLE \ WINS \ UDEB \ SIMPLE. exp "An error occurred while executing link.exe. creating browse info file... SIMPLE. APP-1 error (s), 0 warning (s)

It has not been solved since yesterday. Thank you!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.