473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

VS2005 Command line compilation errors

As alluded to in my post yesterday, I'm trying to compile a common C utility
in Windows.
It's only reference is to zlib.h, which needs zconf.h and in turn libz.a

On Unix I've compiled this with success by running: gcc -lz -o foo.exe foo.c
(where -lz is a link to 'z' or libz.a)

I've placed zlib.h and zconf.h in the VC include folder, and libz.a and
libz.so in the lib folder.

When I run: cl foo.c
from the VS2005 command line tool, I get the following errors (which are the
same errors I would receive on Unix without linking to the libz.a library by
the -lz commnd line argument). I was under the impression that cl called the
linker automatically, so what am I doing wrong here?

/out:foo.exe
foo.obj
foo.obj : error LNK2019: unresolved external symbol _inflate referenced in
function _main
foo.obj : error LNK2019: unresolved external symbol _inflateInit_ referenced
in function _main
foo.exe : fatal error LNK1120: 2 unresolved externals

Thanks in advance!
Evan
Dec 14 '06 #1
4 2611

"wxforecaster" <wx**********@kc.rr.comwrote in message
news:Or**************@TK2MSFTNGP06.phx.gbl...
As alluded to in my post yesterday, I'm trying to compile a common C
utility in Windows.
It's only reference is to zlib.h, which needs zconf.h and in turn libz.a

On Unix I've compiled this with success by running: gcc -lz -o foo.exe
foo.c
(where -lz is a link to 'z' or libz.a)

I've placed zlib.h and zconf.h in the VC include folder, and libz.a and
libz.so in the lib folder.

When I run: cl foo.c
from the VS2005 command line tool, I get the following errors (which are
the same errors I would receive on Unix without linking to the libz.a
library by the -lz commnd line argument). I was under the impression that
cl called the linker automatically, so what am I doing wrong here?
It is calling the linker automatically. These errors are in fact being
generated by the linker, complaining it doesn't know how to resolve them.
You need a libz.lib and libz.dll somewhere. If the libz.lib is not in the
standard LIB path, you need to explicitly reference it from the command
line.

Brian

Dec 14 '06 #2
Brian,

I have tried everything in these regards with placing files in the
lib/include directories. This entire C compilation should have taken about a
minute, but I've wasted hours on it to no avail. I've been to zlib.net and
tried to make heads or tails of this stuff, but I'm honestly at a loss for
straight forward instructions.

Evan
"Brian Muth" <bm***@mvps.orgwrote in message
news:Ok**************@TK2MSFTNGP03.phx.gbl...
>
"wxforecaster" <wx**********@kc.rr.comwrote in message
news:Or**************@TK2MSFTNGP06.phx.gbl...
>As alluded to in my post yesterday, I'm trying to compile a common C
utility in Windows.
It's only reference is to zlib.h, which needs zconf.h and in turn libz.a

On Unix I've compiled this with success by running: gcc -lz -o foo.exe
foo.c
(where -lz is a link to 'z' or libz.a)

I've placed zlib.h and zconf.h in the VC include folder, and libz.a and
libz.so in the lib folder.

When I run: cl foo.c
from the VS2005 command line tool, I get the following errors (which are
the same errors I would receive on Unix without linking to the libz.a
library by the -lz commnd line argument). I was under the impression that
cl called the linker automatically, so what am I doing wrong here?

It is calling the linker automatically. These errors are in fact being
generated by the linker, complaining it doesn't know how to resolve them.
You need a libz.lib and libz.dll somewhere. If the libz.lib is not in the
standard LIB path, you need to explicitly reference it from the command
line.

Brian

Dec 15 '06 #3

"wxforecaster" <eb*********@interwarn.comwrote in message
news:eK*************@TK2MSFTNGP06.phx.gbl...
Brian,

I have tried everything in these regards with placing files in the
lib/include directories. This entire C compilation should have taken about
a minute, but I've wasted hours on it to no avail. I've been to zlib.net
and tried to make heads or tails of this stuff, but I'm honestly at a loss
for straight forward instructions.
Just like gcc needs -lz to tell it to look for libz.a, cl needs to have
"zlib.lib" or some such on the command line to instruct it to link with that
library.
>
Evan
"Brian Muth" <bm***@mvps.orgwrote in message
news:Ok**************@TK2MSFTNGP03.phx.gbl...
>>
"wxforecaster" <wx**********@kc.rr.comwrote in message
news:Or**************@TK2MSFTNGP06.phx.gbl...
>>As alluded to in my post yesterday, I'm trying to compile a common C
utility in Windows.
It's only reference is to zlib.h, which needs zconf.h and in turn libz.a

On Unix I've compiled this with success by running: gcc -lz -o foo.exe
foo.c
(where -lz is a link to 'z' or libz.a)

I've placed zlib.h and zconf.h in the VC include folder, and libz.a and
libz.so in the lib folder.

When I run: cl foo.c
from the VS2005 command line tool, I get the following errors (which are
the same errors I would receive on Unix without linking to the libz.a
library by the -lz commnd line argument). I was under the impression
that cl called the linker automatically, so what am I doing wrong here?

It is calling the linker automatically. These errors are in fact being
generated by the linker, complaining it doesn't know how to resolve them.
You need a libz.lib and libz.dll somewhere. If the libz.lib is not in the
standard LIB path, you need to explicitly reference it from the command
line.

Brian


Dec 15 '06 #4
Yeh, I went the easier route, which was to install the Mingw compiler (win32
equivalent of gcc) and everything is well.

Evan
"Ben Voigt" <rb*@nospam.nospamwrote in message
news:e$**************@TK2MSFTNGP03.phx.gbl...
>
"wxforecaster" <eb*********@interwarn.comwrote in message
news:eK*************@TK2MSFTNGP06.phx.gbl...
>Brian,

I have tried everything in these regards with placing files in the
lib/include directories. This entire C compilation should have taken
about a minute, but I've wasted hours on it to no avail. I've been to
zlib.net and tried to make heads or tails of this stuff, but I'm honestly
at a loss for straight forward instructions.

Just like gcc needs -lz to tell it to look for libz.a, cl needs to have
"zlib.lib" or some such on the command line to instruct it to link with
that library.
>>
Evan
"Brian Muth" <bm***@mvps.orgwrote in message
news:Ok**************@TK2MSFTNGP03.phx.gbl...
>>>
"wxforecaster" <wx**********@kc.rr.comwrote in message
news:Or**************@TK2MSFTNGP06.phx.gbl...
As alluded to in my post yesterday, I'm trying to compile a common C
utility in Windows.
It's only reference is to zlib.h, which needs zconf.h and in turn
libz.a

On Unix I've compiled this with success by running: gcc -lz -o foo.exe
foo.c
(where -lz is a link to 'z' or libz.a)

I've placed zlib.h and zconf.h in the VC include folder, and libz.a and
libz.so in the lib folder.

When I run: cl foo.c
from the VS2005 command line tool, I get the following errors (which
are the same errors I would receive on Unix without linking to the
libz.a library by the -lz commnd line argument). I was under the
impression that cl called the linker automatically, so what am I doing
wrong here?

It is calling the linker automatically. These errors are in fact being
generated by the linker, complaining it doesn't know how to resolve
them. You need a libz.lib and libz.dll somewhere. If the libz.lib is not
in the standard LIB path, you need to explicitly reference it from the
command line.

Brian



Dec 15 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Francesco Martinelli | last post by:
I need to create a multiple file assemby: this requires working directly with the command line compiler (no IDE support!). After a few tests I found my problem comes from the issue described below....
4
by: ARF | last post by:
I'm testing AutoCAD 2005 automation via VS2005 Pro C++/CLR and I'm getting fatal compiler errors. I start with a default C++/CLR class library project and modify it by adding the following...
5
by: GaryDean | last post by:
(my original post was inaccurate but this post accurately describes what I think is a very bad vs2005 bug) short description... Deleting a dataset and recreating it from the dataadapter causes...
16
by: Edward Diener | last post by:
After spending more than a day reducing a complicated compiler bug to a simple case I reported it to the MSDN Product Feedback Center as a bug just now. However this bug is completely stymying my...
5
by: Terry Jolly | last post by:
Here's the problem/question. The goal: run asp pages with apsx pages in the same solution with VS2005 IDE I've loaded my asp pages into a new VS2005. However the asp pages would not run. So, I...
1
by: | last post by:
I'm having a problem finding the cause for this problem. I have a solution in Visual Studio 2005 that contains two projects -- a Web Site and a Class Library. The web site references the class...
0
by: mr_unreliable | last post by:
hi gang, I have seen a code sample that is using the return value from command line compiler as an indicator that an error has occurred (or not) in the compilation. I have searched for some...
0
by: JohnGoogle | last post by:
I've downloaded the source code for RSS Bandit from SourceForge.net (version 1.3.0.38) which was written in C#. I just want to analyse the code to pick up coding tricks etc. I've tried to build...
4
by: Franky | last post by:
I have a cpp program that use to compile in C++6 but give a bunch of errors in VS2005 I'm wondering if I need to reference to some library. I'd appreciate any helpful suggestion Even if...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.