The MASM Forum

Projects => Poasm => Topic started by: Magnum on March 07, 2013, 01:24:19 PM

Title: Can't find header files
Post by: Magnum on March 07, 2013, 01:24:19 PM
I am trying to compile some C code using M.S. cl.exe.

It says it can't find a header file, so I get it.

Then it can't find another header file.

Up to 10 header files so far.

On and on it goes. Ad infinitum

I thought about copying every header file into the include directory.

Is there an easier way ?

Thanks.

Title: Re: Can't find header files
Post by: anta40 on March 07, 2013, 09:09:30 PM
Why don't you use VS Native Tools Command Prompt?
It's way easier, because all the required include and lib directories are already configured.
Title: Re: Can't find header files
Post by: CommonTater on March 07, 2013, 09:35:12 PM
Quote from: Magnum on March 07, 2013, 01:24:19 PM
I am trying to compile some C code using M.S. cl.exe.
It says it can't find a header file, so I get it.

And after that you will discover a whole list of missing libraries....

C and C++ require sets of headers that describe functions in libraries.  While there is not a one to one correlation between headers and libs, there absolutely is a one to one correlation between functions prototyped in headers and functions existing in libraries.

If you download and install theWindows SDK (http://www.microsoft.com/en-ca/download/details.aspx?id=18950) you will have a full set of both headers and libraries for MSVC++ version 9.0 (2008).  This will give you headers in two places... inside the C++ install and inside the SDK install... all you have to do is open a command window compose two path-like strings for the environment...

set INCLUDE=<path to sdk headers>;<path to c++ headers>
set LIB=<path to sdk libs>;<path to c++ libs>

Then, provided you use the same command window, you can run CL and it will know where to find things.

But... if this is plain C code, why not install Pelles C and compile with that? 



Title: Re: Can't find header files
Post by: MichaelW on March 07, 2013, 11:10:24 PM
Or another way, assuming that you are not using in IDE, is to compile with a batch file, in your working directory, that sets up a workable environment so the tools can find the necessary files, for example:

set file="test"
set PATH=C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin;%PATH%
set INCLUDE=C:\Program Files\Microsoft SDK\include;C:\Program Files\Microsoft Visual C++ Toolkit 2003\include;%INCLUDE%
set LIB=C:\Program Files\Microsoft SDK\lib;C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib;%LIB%

cl /W4 %file%.c

pause

Title: Re: Can't find header files
Post by: Magnum on March 08, 2013, 01:41:02 AM
Thanks for all the help.

I installed Poide but it can find the server.

I guess that is where the projects are stored.