NO

Author Topic: LIBRARY  (Read 4701 times)

P_C

  • Guest
LIBRARY
« on: January 20, 2011, 08:25:01 PM »
The compiler can't find <dos.h>, how to add it?

CommonTater

  • Guest
Re: LIBRARY
« Reply #1 on: January 21, 2011, 05:27:52 AM »
The dos.h header is not a standard header in PellesC...

If you have a dos.h and the corresponding dos.lib you would put it into a folder and add it using
the quoted version of #include...

For example if you put it in d:\CProjects\Dos

#include "D:\CProjects\Dos\dos.h" 

Then in your linker options you would add D:\CProjects\Dos\dos.lib or you could use

#pragma lib("D:\CProjects\Dos\Dos.lib")

right under your #include statement in your source file.

P_C

  • Guest
Re: LIBRARY
« Reply #2 on: January 21, 2011, 11:52:59 AM »
Sorry, can you guide me what to do step by step?
the library is here: C:\TC\INCLUDE\DOS.H, how to link? thanks.

CommonTater

  • Guest
Re: LIBRARY
« Reply #3 on: January 21, 2011, 05:04:01 PM »
Just follow the steps I already gave you...

However, if that's a Turbo C library it's unlikely you can use it since TC is 16 bits...

Code: [Select]
// at the top of each C file that needs it...
#include "c:\tc\include\dos.h"

//at the top of your main C file
#pragma lib "c:\tc\lib\dos.lib"
« Last Edit: January 21, 2011, 05:07:49 PM by CommonTater »

P_C

  • Guest
Re: LIBRARY
« Reply #4 on: January 21, 2011, 06:49:25 PM »
Code: [Select]
#include "c:\tc\include\dos.h"
#include<stdio.h>
#pragma lib "c:\tc\lib\dos.lib"
int main()
{
int  x=1,y;
do{
printf("%d\n", x);
for(y=1;y<100000000;y++);
x++;
if (x==100000)
{
printf("DONE :D\n\n");
break;
}
} while (x>0);
}

Like that? It shows an error: "c:\tc\include\dos.h(13): fatal error #1035: Can't find include file <_defs.h>."

CommonTater

  • Guest
Re: LIBRARY
« Reply #5 on: January 21, 2011, 11:56:59 PM »
Your other option is to include the c:\tc\lib and c:\tc\include folders in your project search paths.

Project -> Project Options -> Folders ....

You may still need the #pragma ... though.