Hi, friends I'm a very begginer on C/C++ development, and I work with telecom development. I has work with another tool, but now I'm going to C++, and I got this error that I don't know how to resolve.
I'm using Microsoft Visual C++ 6/ SP 5 on XP Professional.
When I complile its ok I got no errors, but when I build the program happen this errors messages:
agplay.obj : error LNK2001: unresolved external symbol __imp__dx_stopch
agplay.obj : error LNK2001: unresolved external symbol _ATDV_LASTERR
agplay.obj : error LNK2001: unresolved external symbol _ATDV_ERRMSGP
agplay.obj : error LNK2001: unresolved external symbol __imp__dx_wtring
agplay.obj : error LNK2001: unresolved external symbol __imp__dx_sethook
agplay.obj : error LNK2001: unresolved external symbol __imp__ATDX_FWVER
agplay.obj : error LNK2001: unresolved external symbol __imp__dx_open
agplay.obj : error LNK2001: unresolved external symbol __imp__dx_playf
and the source code is this:
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include <conio.h>
#include <stdio.h>
#include <fcntl.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <sctools.h>
long currentHandle;
long handle;
int event = 0;
int data = 0;
int eventType;
int enableff=0;
int results;
int ch1h;
DV_TPT tpt;
DX_IOTT iott;
DV_DIGIT digp;
void ctrl_c_hdlr(int sig);
DWORD WINAPI play_thread(int *mode);
HANDLE recordh;
int n;
DWORD threadid;
int exitvalue;
int mode;
int fileh;
void ctrl_c_hdlr(int sig){
printf("Exiting Application\n"
exitvalue=1;
exit(0);
}
char filename[1024];
int modevalue;
int main( int argc, char *argv[])
{
if (argc <= 1) {
printf("\n Usage: %s \n\n",argv[0]);
printf("\n (i.e.) %s data.vox\n",argv[0]);
exit(1);
}
sprintf(filename,"%s",argv[1]);
printf("File to Open: %s\n",filename);
if ( (ch1h = dx_open("dxxxB1C1",0)) == -1){
printf("ERROR: on dx_open() on device dxxxB1C1\n"
printf("ERROR: is %d\n",errno);
exit(0);
}
printf("Opened dxxxB1C1 (%08lx)\n", ATDX_FWVER(ch1h));
printf ("Going Onhook . . . . . . . . . . "
if (dx_sethook(ch1h,DX_ONHOOK,EV_SYNC)){
printf ("\n"
printf ("Error setting onhook\n"
exit(0);
}
printf("done\n"
printf ("Waiting for call . . . . . . . . \n"
if (dx_wtring(ch1h,1,DX_OFFHOOK,30) == -1) {
printf ("\n"
printf("Error executing dx_wtring\n"
printf("Last error = %d ErrMsg = %s \n",ATDV_LASTERR(ch1h),ATDV_ERRMSGP(ch1h));
exit(0);
}
printf ("Ring Event received. Taking Channel Offhook\n"
printf("\nSelect one of the options and then dial into channel 1\n\n"
printf("\n*** Press \t'1' \tto play %s at 6Khz ADPCM ",filename);
printf("\n*** Press \t'2' \tto play %s at 8Khz ADPCM",filename);
printf("\n*** Press \t'3' \tto play %s at 6Khz PCM ",filename);
printf("\n*** Press \t'4' \tto play %s at 8Khz PCM ",filename);
printf("\n\n*** Press \t's' \tto stop playing"
printf("\n*** Press \t'ESC' \tto EXIT\n\n\n"
while( 1 ) {
if ( kbhit() ) {
switch( getch() ) {
case 27:
exit(1) ;
case '1':
// record at 6K ADPCM w/ AGC
modevalue=RM_SR6|MD_ADPCM|EV_SYNC;
recordh = CreateThread(NULL,0,play_thread,
&modevalue,
CREATE_SUSPENDED,&threadid);
SetThreadPriority(recordh , THREAD_PRIORITY_NORMAL);
ResumeThread(recordh );
printf("\n< Hit 's' to stop recording. Hit 'Esc' to exit >\n"
break;
case '2':
// record at 8K ADPCM w/ AGC
modevalue=RM_SR8|MD_ADPCM|EV_SYNC;
recordh = CreateThread(NULL,0,play_thread,
&modevalue,
CREATE_SUSPENDED,&threadid);
SetThreadPriority(recordh, THREAD_PRIORITY_NORMAL);
ResumeThread(recordh);
printf("\n< Hit 's' to stop recording. Hit 'Esc' to exit >\n"
break;
case '3':
// record at 6K PCM w/ AGC
modevalue=RM_SR6|MD_PCM|EV_SYNC;
recordh = CreateThread(NULL,0,play_thread,
&modevalue,
CREATE_SUSPENDED,&threadid);
SetThreadPriority(recordh, THREAD_PRIORITY_NORMAL);
ResumeThread(recordh);
printf("\n< Hit 's' to stop recording. Hit 'Esc' to exit >\n"
break;
case '4':
// record at 8K PCM w/ AGC
modevalue=RM_SR8|MD_PCM|EV_SYNC;
recordh = CreateThread(NULL,0,play_thread,
&modevalue,
CREATE_SUSPENDED,&threadid);
SetThreadPriority(recordh, THREAD_PRIORITY_NORMAL);
ResumeThread(recordh);
printf("\n< Hit 's' to stop recording. Hit 'Esc' to exit >\n"
break;
case 's':
// issuing the stopchannel
if ( dx_stopch(ch1h,EV_SYNC) == -1){
printf("Error issuing stopchannel\n"
exit(0);
}
printf("Stop channel issued succesfully\n"
break;
}
}
}
return 0;
}
DWORD WINAPI play_thread(int *mode)
{
static DV_TPT tptx;
static DX_IOTT iottx;
printf("...play_thread: Inside the thread\n"
switch(*mode){
case(RM_SR6|MD_ADPCM|EV_SYNC):
printf("...play_thread: Play at RM_SR6|MD_ADPCM|EV_SYNC\n"
break;
case(RM_SR6|MD_PCM|EV_SYNC):
printf("...play_thread: Play at RM_SR6|MD_PCM|EV_SYNC\n"
break;
case(RM_SR8|MD_PCM|EV_SYNC):
printf("...play_thread: Play at RM_SR8|MD_PCM|EV_SYNC\n"
break;
case(RM_SR8|MD_ADPCM|EV_SYNC):
printf("...play_thread: Play at RM_SR8|MD_ADPCM|EV_SYNC\n"
break;
} // end switch
/////////////////////////
printf("...play_thread: Starting to Play....\n"
tptx.tp_type = IO_EOT;
tptx.tp_termno = DX_MAXDTMF;
tptx.tp_length = 1;
tptx.tp_flags = TF_MAXDTMF;
printf ("...play_thread: Playing on Channel 1. . . . . . . . . . \n"
printf("...play_thread: About to play file: %s\n",filename);
if (dx_playf(ch1h,filename,&tptx,*mode) == -1) {
printf ("Error playing %s\n",ATDV_ERRMSGP(ch1h));
}
printf("...play_thread: Exiting the play thread\n"
return 1;
}
}
Could you help me ???
Very thanks ...
Danilo Almeida.
I'm using Microsoft Visual C++ 6/ SP 5 on XP Professional.
When I complile its ok I got no errors, but when I build the program happen this errors messages:
agplay.obj : error LNK2001: unresolved external symbol __imp__dx_stopch
agplay.obj : error LNK2001: unresolved external symbol _ATDV_LASTERR
agplay.obj : error LNK2001: unresolved external symbol _ATDV_ERRMSGP
agplay.obj : error LNK2001: unresolved external symbol __imp__dx_wtring
agplay.obj : error LNK2001: unresolved external symbol __imp__dx_sethook
agplay.obj : error LNK2001: unresolved external symbol __imp__ATDX_FWVER
agplay.obj : error LNK2001: unresolved external symbol __imp__dx_open
agplay.obj : error LNK2001: unresolved external symbol __imp__dx_playf
and the source code is this:
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include <conio.h>
#include <stdio.h>
#include <fcntl.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <sctools.h>
long currentHandle;
long handle;
int event = 0;
int data = 0;
int eventType;
int enableff=0;
int results;
int ch1h;
DV_TPT tpt;
DX_IOTT iott;
DV_DIGIT digp;
void ctrl_c_hdlr(int sig);
DWORD WINAPI play_thread(int *mode);
HANDLE recordh;
int n;
DWORD threadid;
int exitvalue;
int mode;
int fileh;
void ctrl_c_hdlr(int sig){
printf("Exiting Application\n"
exitvalue=1;
exit(0);
}
char filename[1024];
int modevalue;
int main( int argc, char *argv[])
{
if (argc <= 1) {
printf("\n Usage: %s \n\n",argv[0]);
printf("\n (i.e.) %s data.vox\n",argv[0]);
exit(1);
}
sprintf(filename,"%s",argv[1]);
printf("File to Open: %s\n",filename);
if ( (ch1h = dx_open("dxxxB1C1",0)) == -1){
printf("ERROR: on dx_open() on device dxxxB1C1\n"
printf("ERROR: is %d\n",errno);
exit(0);
}
printf("Opened dxxxB1C1 (%08lx)\n", ATDX_FWVER(ch1h));
printf ("Going Onhook . . . . . . . . . . "
if (dx_sethook(ch1h,DX_ONHOOK,EV_SYNC)){
printf ("\n"
printf ("Error setting onhook\n"
exit(0);
}
printf("done\n"
printf ("Waiting for call . . . . . . . . \n"
if (dx_wtring(ch1h,1,DX_OFFHOOK,30) == -1) {
printf ("\n"
printf("Error executing dx_wtring\n"
printf("Last error = %d ErrMsg = %s \n",ATDV_LASTERR(ch1h),ATDV_ERRMSGP(ch1h));
exit(0);
}
printf ("Ring Event received. Taking Channel Offhook\n"
printf("\nSelect one of the options and then dial into channel 1\n\n"
printf("\n*** Press \t'1' \tto play %s at 6Khz ADPCM ",filename);
printf("\n*** Press \t'2' \tto play %s at 8Khz ADPCM",filename);
printf("\n*** Press \t'3' \tto play %s at 6Khz PCM ",filename);
printf("\n*** Press \t'4' \tto play %s at 8Khz PCM ",filename);
printf("\n\n*** Press \t's' \tto stop playing"
printf("\n*** Press \t'ESC' \tto EXIT\n\n\n"
while( 1 ) {
if ( kbhit() ) {
switch( getch() ) {
case 27:
exit(1) ;
case '1':
// record at 6K ADPCM w/ AGC
modevalue=RM_SR6|MD_ADPCM|EV_SYNC;
recordh = CreateThread(NULL,0,play_thread,
&modevalue,
CREATE_SUSPENDED,&threadid);
SetThreadPriority(recordh , THREAD_PRIORITY_NORMAL);
ResumeThread(recordh );
printf("\n< Hit 's' to stop recording. Hit 'Esc' to exit >\n"
break;
case '2':
// record at 8K ADPCM w/ AGC
modevalue=RM_SR8|MD_ADPCM|EV_SYNC;
recordh = CreateThread(NULL,0,play_thread,
&modevalue,
CREATE_SUSPENDED,&threadid);
SetThreadPriority(recordh, THREAD_PRIORITY_NORMAL);
ResumeThread(recordh);
printf("\n< Hit 's' to stop recording. Hit 'Esc' to exit >\n"
break;
case '3':
// record at 6K PCM w/ AGC
modevalue=RM_SR6|MD_PCM|EV_SYNC;
recordh = CreateThread(NULL,0,play_thread,
&modevalue,
CREATE_SUSPENDED,&threadid);
SetThreadPriority(recordh, THREAD_PRIORITY_NORMAL);
ResumeThread(recordh);
printf("\n< Hit 's' to stop recording. Hit 'Esc' to exit >\n"
break;
case '4':
// record at 8K PCM w/ AGC
modevalue=RM_SR8|MD_PCM|EV_SYNC;
recordh = CreateThread(NULL,0,play_thread,
&modevalue,
CREATE_SUSPENDED,&threadid);
SetThreadPriority(recordh, THREAD_PRIORITY_NORMAL);
ResumeThread(recordh);
printf("\n< Hit 's' to stop recording. Hit 'Esc' to exit >\n"
break;
case 's':
// issuing the stopchannel
if ( dx_stopch(ch1h,EV_SYNC) == -1){
printf("Error issuing stopchannel\n"
exit(0);
}
printf("Stop channel issued succesfully\n"
break;
}
}
}
return 0;
}
DWORD WINAPI play_thread(int *mode)
{
static DV_TPT tptx;
static DX_IOTT iottx;
printf("...play_thread: Inside the thread\n"
switch(*mode){
case(RM_SR6|MD_ADPCM|EV_SYNC):
printf("...play_thread: Play at RM_SR6|MD_ADPCM|EV_SYNC\n"
break;
case(RM_SR6|MD_PCM|EV_SYNC):
printf("...play_thread: Play at RM_SR6|MD_PCM|EV_SYNC\n"
break;
case(RM_SR8|MD_PCM|EV_SYNC):
printf("...play_thread: Play at RM_SR8|MD_PCM|EV_SYNC\n"
break;
case(RM_SR8|MD_ADPCM|EV_SYNC):
printf("...play_thread: Play at RM_SR8|MD_ADPCM|EV_SYNC\n"
break;
} // end switch
/////////////////////////
printf("...play_thread: Starting to Play....\n"
tptx.tp_type = IO_EOT;
tptx.tp_termno = DX_MAXDTMF;
tptx.tp_length = 1;
tptx.tp_flags = TF_MAXDTMF;
printf ("...play_thread: Playing on Channel 1. . . . . . . . . . \n"
printf("...play_thread: About to play file: %s\n",filename);
if (dx_playf(ch1h,filename,&tptx,*mode) == -1) {
printf ("Error playing %s\n",ATDV_ERRMSGP(ch1h));
}
printf("...play_thread: Exiting the play thread\n"
return 1;
}
}
Could you help me ???
Very thanks ...
Danilo Almeida.