Learning how to use cl.exe 
Author Message
 Learning how to use cl.exe

Hi.

I'm pretty new to C, and very new to building things on Win32. Can
anybody point me at some resources that will get me up to speed on
what different file types are and the basics of linking various object
files together into libraries, etc? I'm using the compiler that comes
with Visual Studio 6 from the command line (cl.exe).

Thanks very much.

--
Graham

P.S. I'm currently trying to use cl.exe to compile a .c and .h file
into a library that I can then persuade it to link to when building
another library from a .c file. To give you some idea of how little I
know about it, I'm stuck with:

C:\Program Files\Microsoft Visual Studio\VC98\BIN\cl.exe /c /nologo
/Ox /MD /W3
/GX "-Ic:\program files\python\Include" /TcCISprocess.c
/Fobuild\temp.win32-1.5\Release\CISprocess.obj CISprocess.c C:\Program
Files\Microsoft Visual Studio\VC98\BIN\link.exe /DLL /nologo
/INCREMENTAL:NO "/LIBPATH:c:\program files\python\libs"
/EXPORT:initCISprocess build\temp.win32-1.5\Release\CISprocess.obj
/OUT:build\lib.win32-1.5\CISprocess.pyd
/IMPLIB:build\temp.win32-1.5\Release\CISprocess.lib
Creating library build\temp.win32-1.5\Release\CISprocess.lib and
object build
\temp.win32-1.5\Release\CISprocess.exp
CISprocess.obj : error LNK2001: unresolved external symbol

build\lib.win32-1.5\CISprocess.pyd : fatal error LNK1120: 1 unresolved
externals

error: command '"C:\Program Files\Microsoft Visual
Studio\VC98\BIN\link.exe"' failed with exit status 1120



Sun, 27 Jun 2004 23:45:51 GMT  
 Learning how to use cl.exe

Quote:
> Hi.
> I'm pretty new to C, and very new to building things on Win32. Can
> anybody point me at some resources that will get me up to speed on
> what different file types are and the basics of linking various object
> files together into libraries, etc? I'm using the compiler that comes
> with Visual Studio 6 from the command line (cl.exe).
> Thanks very much.

Sorry, we talk about the C language itself here, not specific C
compilers. I suggest you find a Win32-specific newsgroup and ask there.

--

| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste       W++ B OP+                     |
\----------------------------------------- Finland rules! ------------/
"The truth is out there, man! Way out there!"
   - Professor Ashfield



Sun, 27 Jun 2004 23:48:15 GMT  
 Learning how to use cl.exe

Quote:

> Hi.

> I'm pretty new to C, and very new to building things on Win32. Can
> anybody point me at some resources that will get me up to speed on
> what different file types are and the basics of linking various object
> files together into libraries, etc? I'm using the compiler that comes
> with Visual Studio 6 from the command line (cl.exe).

Very briefly (because this is off-topic):

.c   ---- C file
.obj ---- object file
.lib ---- library file
.exe ---- executable file

To link various object files together into a library, use the LIB
command (unless MS have changed this recently, which they may have done,
which is one reason why it's a better idea to ask this question in a
Windows programming newsgroup).

To link an existing library into your code (let's say it's called
mylib.lib), the following should be sufficient:

cl -Za -W4 myprog.c mylib.lib

In future, please try to ask platform-specific questions like this in
platform-specific newsgroups (e.g. comp.os.ms-windows.programmer.win32)
- comp.lang.c is for questions about the C language itself, not
Microsoft tools.

Thanks.

<snip>

--

"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton



Mon, 28 Jun 2004 00:28:59 GMT  
 Learning how to use cl.exe

Quote:

> Hi.

> I'm pretty new to C, and very new to building things on Win32. Can
> anybody point me at some resources that will get me up to speed on
> what different file types are and the basics of linking various object
> files together into libraries, etc? I'm using the compiler that comes
> with Visual Studio 6 from the command line (cl.exe).

> Thanks very much.

Not yet, because this is an off-topic question. Anyways, the problem
is really simple. You are simply missing out a required library while
linking.

Check your documentation as to where in the world is the offending
function "EnumProcs" and get it's library name and then simply add the
following to the "cl"  command line (or link options if you are
working in the IDE)

/defaultlib:libname

that should do. [Note: replace the "libname" with the name of the
library including it's extension]

That should do.

Raj



Mon, 28 Jun 2004 13:56:54 GMT  
 Learning how to use cl.exe

Quote:


> > I'm pretty new to C, and very new to building things on Win32.

> Very briefly (because this is off-topic):

Ooops - sorry about that, I didn't realise. Thanks for all the answers
though; it now works a treat.

--
Graham



Mon, 28 Jun 2004 21:11:31 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. redistributing cl.exe, link.exe, nmake.exe, etc.

2. cl.exe, link.exe, mscvrt.exe Madness...

3. rc.exe or cl.exe error

4. cl.exe / link.exe taking all the processor time

5. How to use cl.exe and c2.exe?

6. Compile error: Error Spawning Cl.exe or link.exe

7. HELP!!! cl.exe And bscmake.exe Errors

8. error spawning cl.exe when profile

9. Buffer overrun detected in cl.exe

10. error PRJ0003: Error spawning 'cl.exe'.

11. Problem with CL.EXE from .NET SDK

12. error spawning cl.exe in v6

 

 
Powered by phpBB® Forum Software