Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

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 online now
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,390 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 22 h 36 m 15 sec
Reputation Power: 4080
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

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

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap