Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 4th, 2003, 11:37 AM
teo.castoro teo.castoro is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: milan
Posts: 14 teo.castoro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy linker error

Hi! I'm tryin' to create a dll with BCB5 but I've some linking problems. These are the errors:

[Linker Error] Unresolved external '__fastcall TForm2::KeyEvent(Messages::TWMKey&, bool&)' referenced from D:\DOCUMENTS AND SETTINGS\MATTEO\DESKTOP\NEW FOLDER\TRIGGER3SEC_SRC.OBJ
[Linker Error] Unresolved external '_KeyPressed' referenced from D:\DOCUMENTS AND SETTINGS\MATTEO\DESKTOP\NEW FOLDER\TRIGGER3SEC_SRC.OBJ

And this is the code:


// trigger3sec_src


//---------------------------------------------------------------------------
#include <vcl.h>
#include <windows.h>
#pragma hdrstop

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

#include <time.h>
#include "Unit2.h"
#pragma argsused
time_t start;


int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
Form2=new TForm2(NULL);
Application->OnShortCut=Form2->KeyEvent;
start=time(NULL);
KeyPressed=false;
return 1;
}
//---------------------------------------------------------------------------
extern "C"
{
bool __export GetEvent()
{
bool ret=false;
time_t now=time(NULL);
if((now-start>3))//||(KeyPressed))
{
ret=true;
start=time(NULL);
// KeyPressed=false;
}
return ret;
}
}


// Unit2.cpp


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

#include <vcl.h>
#pragma hdrstop

#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall KeyEvent(Messages::TWMKey &Msg, bool &Handled)
{
if(Msg.CharCode == VK_ESCAPE)
{
KeyPressed=true;
Handled = true;
}
}


// Unit2.h


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

#ifndef Unit2H
#define Unit2H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm2 : public TForm
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TForm2(TComponent* Owner);
void __fastcall KeyEvent(Messages::TWMKey &Msg, bool &Handled);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm2 *Form2;
extern bool KeyPressed;
//---------------------------------------------------------------------------
#endif

The program should change the Color of Form2 every 3 sec or if the key Esc is pressed.
Anyone can help me, please?
Sorry 4 my English!
Comments on this post
Gran Roguismo agrees!

Reply With Quote
  #2  
Old November 4th, 2003, 12:31 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,508 Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level)Scorpions4ever User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 16 m 59 sec
Reputation Power: 865
See my reply to your thread on the C forum
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month

Reply With Quote
  #3  
Old November 4th, 2003, 05:47 PM
teo.castoro teo.castoro is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: milan
Posts: 14 teo.castoro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile

Thank you very much..now it works. As I thought,it was something of really stupid....but I'm a raw in c++!

Reply With Quote
  #4  
Old November 4th, 2003, 06:29 PM
teo.castoro teo.castoro is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: milan
Posts: 14 teo.castoro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question

Uhmmm…maybe I’m more stupid than I thought ‘cause it DOESN’T work…
I’ve modified the code as follow:


// trigger3sec_src


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

#include <vcl.h>
#include <windows.h>
#pragma hdrstop
//---------------------------------------------------------------------------

#include <time.h>
#include "Unit2.h"
#pragma argsused
time_t start;


int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
Form2=new TForm2(NULL);
Application->OnShortCut=Form2->KeyEvent;
start=time(NULL);
KeyPressed=false;
return 1;
}
//---------------------------------------------------------------------------


extern "C"
{
bool __export GetEvent()
{
bool ret=false;
time_t now=time(NULL);
if((now-start>3)||(KeyPressed))
{
ret=true;
start=time(NULL);
KeyPressed=false;
}
return ret;
}
}


// Unit2.cpp


//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
bool KeyPressed;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall KeyEvent(Messages::TWMKey &Msg, bool &Handled)
{
if(Msg.CharCode == VK_ESCAPE)
{
KeyPressed=true;
Handled = true;
}
}

// Unit2.h


//---------------------------------------------------------------------------
#ifndef Unit2H
#define Unit2H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm2 : public TForm
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TForm2(TComponent* Owner);
void __fastcall KeyEvent(Messages::TWMKey &Msg, bool &Handled);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm2 *Form2;
extern bool KeyPressed;

//---------------------------------------------------------------------------
#endif

Now there is only one linker error:
[Linker Error] Unresolved external '__fastcall TForm2::KeyEvent(Messages::TWMKey&, bool&)' referenced from D:\DOCUMENTS AND SETTINGS\MATTEO\DESKTOP\NEW FOLDER\TRIGGER3SEC_SRC.OBJ
related to KeyEvent. The error related to KeyPressed desappeared.
Any suggestion?
Thanx!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > linker error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway