大虾们好~ 我用组态王做上位机,5510M的控制器,slot0:adam5017, slot1: adam5060 程序如下: #include "mrtu.h" #include "5510drv.h" #include "conio.h" void main() { int result; char c; int ch; int *out;
/*------first scan IO module-------*/ Init501718(0); SetCom1ToPC(9600L,8,0,1); SetCom2ToPC(9600L,8,0,1); ch=0; while(1) { /*----------Check whether the AI data of the slot 0 is ready------*/ if(AiUpdate(0,&ch)==0) { /*--AI is ready,then return current channel index--*/ /*--Get one channel data-- */ /*--The data format of AI value is a signed engineering unit.--*/ Get501718(0,ch,&result); SetWordIn(ch+1,result); } GetBitOut(1,out); Set5060(out,2,0,ABit); ProReqCom1(); ProReqCom2(); } } 这部分是用组态王6.51盘里头的demo程序改的~~~,compile成功,但是没有想到出现link的错误:
Linking QXC01.EXE: │ │?Linker Error: Undefined symbol _main in module c0.ASM
编译器是broland的 tc++ 3.0, adam的工作模式选择是small,cpu类型也是80168,link settings里面为standard exe(组态王里头写的是standard dos exe,但是tc++3.0里面只有stadnard exe)
* The "generate underbars" option is disabled. * The Pascal calling Convention rather than the C calling convention is selected.
http://bdn.borland.com/article/0,1410,17488,0.html "Undefined Symbol '_main' in Module C0.ASM" ====================================================================== Every C program must contain a function called main(). This is the first function executed in your program. The function name must be all in lower case. If your program does not have one, create one. If you are using multiple source files, the file that contains the function main() must be one of the files listed in the Project. Note that an underscore character '_' is prepended to all external Turbo C++ symbols. In addition to an absent, misspelled or mis-cased symbol main, there are two additional common causes: * The "generate underbars" option is disabled. * The Pascal calling Convention rather than the C calling convention is selected.
* The "generate underbars" option is disabled. * The Pascal calling Convention rather than the C calling convention is selected.
http://bdn.borland.com/article/0,1410,17488,0.html "Undefined Symbol '_main' in Module C0.ASM" ====================================================================== Every C program must contain a function called main(). This is the first function executed in your program. The function name must be all in lower case. If your program does not have one, create one. If you are using multiple source files, the file that contains the function main() must be one of the files listed in the Project. Note that an underscore character '_' is prepended to all external Turbo C++ symbols. In addition to an absent, misspelled or mis-cased symbol main, there are two additional common causes: * The "generate underbars" option is disabled. * The Pascal calling Convention rather than the C calling convention is selected.