Author Topic: Can't find header files  (Read 16034 times)

Magnum

  • Member
  • *****
  • Posts: 2396
Can't find header files
« 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.

Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

anta40

  • Member
  • ***
  • Posts: 315
Re: Can't find header files
« Reply #1 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.

CommonTater

  • Guest
Re: Can't find header files
« Reply #2 on: March 07, 2013, 09:35:12 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 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? 
 
 
 
 

MichaelW

  • Global Moderator
  • Member
  • *****
  • Posts: 1196
Re: Can't find header files
« Reply #3 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:
Code: [Select]
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
Well Microsoft, here’s another nice mess you’ve gotten us into.

Magnum

  • Member
  • *****
  • Posts: 2396
Re: Can't find header files
« Reply #4 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.

Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org