⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 helpme!.doc

📁 c compiler with added projects...
💻 DOC
📖 第 1 页 / 共 3 页
字号:
         BGIDEMO.C 
         *.BGI 
         *.CHR 
  
    2. Run Turbo C++. 
  
    3. Load BGIDEMO.C into the Editor by pressing F3, then typing 
       BGIDEMO<Enter> 
  
    3. Go to the Run menu and choose the Run item. 
  
 Q. How do I create a COM file? 
 A. DOS versions 3.2 and earlier include an EXE2BIN utility that 
    converts EXE files to COM files. Users who do not have EXE2BIN can 
    use TLINK, the Turbo C++ command-line linker, to create a COM file 
    instead of an EXE file. Use the /t option. For example: 
  
       TCC -mt -lt tiny 
  
    will create TINY.COM instead of TINY.EXE. The -l switch passes 
    the /t argument to the linker in this case. 
  
    There are certain limitations in converting an EXE file to a COM 
    file. These limitations are documented in the IBM Disk Operating 
    System manual under EXE2BIN. 
  
    Turbo C++'s TINY model is compatible with the COM format, but programs 
    that use Turbo C++'s floating-point routines cannot be used in a 
    TINY model application. 
  
  
 G r a p h i c s 
 ---------------------------------------------------------------------- 
 Q. Why do I get the error message: 
  
       BGI Error: graphics not initialized (use 'initgraph') 
  
    when I use a graphics function? My program has already 
    called initgraph(). 
 A. For some reason initgraph() failed. To find out why, check 
    the return value of graphresult(). For example: 
  
      #include <graphics.h> 
      int main(void) 
      { 
        int gerr;   /* graphics error */ 
        int gdriver = DETECT, gmode; 
  
        /* Initialize graphics using auto-detection and look 
           for the .BGI and .CHR files in the C:\TC\BGI directory. 
        */ 
        initgraph(&gdriver, &gmode, "C:\\TC\\BGI"); 
  
        if ((gerr = graphresult()) != grOk) 
        { 
            printf("Error : %s\n", grapherrormsg(gerr)); 
            exit(1); 
        } 
               : 
      } 
  
  
 M a t h  /  F l o a t i n g    P o i n t 
 ---------------------------------------------------------------------- 
 Q. Why do I get incorrect results from all the math library 
    functions like cos(), tan() and atof()? 
 A. You must #include <math.h> before you call any of the standard 
    Turbo C++ math functions. In general, Turbo C++ assumes that a function 
    that is not declared returns an int. In the case of math functions, 
    they usually return a double. For example 
  
        /* WRONG */                       /* RIGHT */ 
                                          #include <math.h> 
        int main(void)                    int main(void) 
        {                                 { 
          printf("%f", cos(0));             printf("%f", cos(0)); 
        }                                 } 
  
 Q. How do I "trap" a floating-point error? 
 A. See the signal() and matherr() functions in the online help. The 
    signal() function may be used to trap errors in the 80x87 or the 
    80x87 emulator. The matherr() function traps errors in the Math 
    Library functions. 
  
  
 L i n k e r    E r r o r s 
 ---------------------------------------------------------------------- 
 Q. I am linking C functions with C++ functions.  The linker reports that 
    all of my C functions are undefined.  Why? 
 A. Linking C++ modules with C modules requires the use of a linkage 
    specification.  Prototypes for C functions within C++ modules must 
    be in one of the following forms: 
  
        extern "C" declaration 
        extern "C" { declarations } 
  
    For example, if a C module contains functions 
    "char *SCopy(char*, char*);" and "void ClearScreen(void)", they 
    must be declared in a C++ module in one of the following ways: 
  
        extern "C" char *SCopy(char*, char*); 
        extern "C" void ClearScreen(void); 
  
    or 
  
        extern "C" { 
            char *SCopy(char*, char*) 
            void ClearScreen(void); 
        } 
  
    For further examples, see the standard header files.  For additional 
    comment, see Common C++ Questions. 
  
 Q. Why do I get the message: 
      Linker Error: Unable to open input file 'C0x.OBJ' 
 A. See the "Integrated Environment" section above. 
  
 Q. Why do I get the message: 
      Linker Error: Undefined symbol '_main' in module C0 
 A. 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. 
  
 Q. Why does the linker tell me that all the graphics library 
    routines are undefined? 
 A. See the "Integrated Environment" and "Command-line Compiler" 
    sections above. 
  
 Q. What is a 'Fixup overflow'? 
 A. See the listing of TLINK error messages in the Turbo C++ 
    User's Guide. 
  
 Q. I am linking my own assembly language functions with Turbo C++. 
    The linker reports that all of my functions are undefined. 
 A. Make sure that you have put an underbar character '_' in front of all 
    assembly language function names to be called by Turbo C++. Your 
    assembly language program should be assembled with Case Sensitivity. 
    If compiling as C++ (rather than C), see the "Common C++ Questions" 
    section above which discusses the use of extern "C". 
  
 Q: I am getting an error out of the linker "segment group exceeds 64K : 
    _text". 
 A: If you are using the BGIOBJ utility, the default segment into which 
    the objects will be place is _text.  You should try using BGIOBJ with 
    the /f option to place the resultant objects into a separate segment. 
    You will then need to use the functions registerfarbgidriver and 
    registerfarbgifont to register the objects for the graphics system. 
    See UTIL.DOC for instructions on using these functions. 
  
 Q: I am attempting to link Turbo C 2.0 objects into my Turbo C++ programs, 
    but continually get unresolved external symbols at link time. 
 A: The names of many of the "helper" functions have changed from what they 
    were in Turbo C 2.0. If you are getting undefined symbols like _LXLSH and 
    _FMUL, this is the problem you are running into.  Your best solution is to 
    get the source code to the old object modules and recompile with Turbo C++. 
    The only other possibility would be to extract the helper function objects 
    from the Turbo C 2.0 libraries and link them into the Turbo C++ program. 
  
 Q. I'm porting an application that uses communal variables to C++. 
    I've set up the compiler to recognize them, but I still get linker 
    errors: 
  
      Error: <name> defined in module <a> is duplicated in module <b> 
  
 A. C++ doesn't support explicit COMDEFs; you must use static 
    variables or switch to C. 
  
 O t h e r    Q u e s t i o n s 
 ---------------------------------------------------------------------- 
 Q. I get a "floating point formats not linked" message when I run 
    my program. What can I do about it? 
  
 A. Floating point formats (for scanf() and related functions) are 
    not always linked, for savings in executable size. To force their 
    inclusion, put the following somewhere in your source files: 
  
      extern unsigned _floatconvert; 
      #pragma extref _floatconvert 
  
 Q. How do I change the stack size? 
 A. The size of the stack of a Turbo C++ program is determined at 
    run time by the global variable _stklen. To change the size 
    to, for example, 10,000 bytes, include the following line in 
    your program: 
  
      extern unsigned _stklen = 10000; 
  
    This statement must not be inside any function definition. 
    The default stack size is 4,096 bytes (4K). 
  
 Q. I'm getting a 'Stack Overflow!' message when I run my program. 
    How can I work around this? 
 A. You may increase the stack size by following the procedure above. Stack 
    overflows are usually caused by a large amount of local data or 
    recursive functions. You can decrease the amount of stack space 
    used by declaring your local variables static: 
  
         int main(void)                int main(void) 
         {                             { 
             char x[5000];     -->          static char x[5000]; 
                 :                                : 
         }                             } 
  
    Of course, you should be aware that there are other effects 
    that the "static" keyword has, as applied here. 
  
 Q. My program comes up with the message 'Null pointer assignment' 
    after it terminates. What does this mean? 
 A. Before a small-data model Turbo C++ program returns to DOS, it will 
    check to see if the beginning of its data segment has been corrupted. 
    This message is to warn you that you have used uninitialized pointers 
    or that your program has corrupted memory in some other way. 
  
 Q. Why are .EXE files generated by TC.EXE larger than those generated by 
    TCC.EXE? 
 A. In the default configuration, TC.EXE includes debugging information in 
    the .EXE files that it creates, and TCC.EXE does not. If you don't want 
    to produce this debugging information, you can shut it off in the 
    Integrated Development Environment by selecting Alt-O|B|N. 
  
 Q. Why do I get "declaration syntax error" messages on dos.h? 
 A. You have set the "ANSI keywords only" option ON. Keep this option OFF 
    when using any keywords specific to Turbo C++. 
  
 Q. I have a working program that dynamically allocates memory 
    using malloc() or calloc() in small data models (tiny, small, 
    and medium). When I compile this program in large data models 
    (compact, large, and huge), my program hangs. 
 A. Make sure that you have #include <alloc.h> in your program. 
  
 Q. I am linking my own assembly language functions with Turbo C++. 
    But the linker reports that all of my functions are undefined. 
 A. See answer above in the "Linker" section. 
  
 Q. My far pointers "wrap around" when they are incremented over 64K. 
    How do I reference a data object that is greater than 64K? 
 A. Use huge pointers. 
  
 Q. How do I interface Turbo C++ routines to a Turbo Pascal program? 
 A. See the example programs CPASDEMO.PAS and CPASDEMO.C. 
  
 Q. How do I get Clipper to link with Turbo C++? 
 A. If you are having trouble, contact Nantucket Technical Support. 
  
 Q. I'm trying to build an app based on one of Borland's libraries 
    (Turbo Vision, the container classes in the CLASSLIB directory, 
    or the Runtime Library),  and I get linker errors, or it won't 
    run right. What's going wrong? 
  
 A. You may be using a switch that affects linkage in your files, 
    that was not used when the library itself was compiled, or you 
    need to change the library in question. Here are some examples: 
  
    - If you use far vtables (-Vf or Options|Compiler|C++|Far 
      virtual tables) to compile a file you developed which 
      includes iostream.h, it won't build correctly until you 
      rebuild the iostream library with the same option. 
  
    - If you use word alignment (-a or Options|Compiler|Code 
      Generation|Word alignment) in building a Turbo Vision 
      application, you must build the Turbo Vision library from 
      source with the same option. 
 


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -