Re: error LNK2019: unresolved external symbol

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"lalo" <helene.ayari@xxxxxxxxx> wrote

Here are some more information about my system:
I am using the microsoft visual basic express.
I take it that is or includes Visual C++ 2005.

I installed the microsoft sdk for my platform (windows xp pack 2)
Excellent. But you should need that for using Windows specific
functionality only. The <string> header is part of the C++.

I can find files like <string> either in the folder:
That's because the Platform SDK includes the full C++
toolchain. When you build from within the IDE it uses
the headers from its own installation (Visual Studio, that is).
You could change these settings in Tool->Options->Project
->Directories, but you should _not_ do so in your case.

I copied for you the error when building a .exe because there were no
error when building a .lib
Yes, my bad. I misread your explanation. You need to understand
what happens when building a library (.lib) or a fully linked image
(.exe or .dll).

A library is effectively a collection of object files (you can think of
it as a TAR file with symbol table). So when you build a .lib then
linker does not kick in at all.

When you build an image (.exe or .dll) the linker recursively
resolves references from your object files and select object files
from your libraries to satisfy these references.

I can find for exemple on my computer the file in <iostream>
C:\Program Files\Microsoft Visual Studio 8\VC\include
and in
C:\Program Files\Microsoft SDK\Include\crt
and then choose in which folder the compiler should look for.
The error messages copied here are the ones using the microsoft sdk
folder.
You should use the standard setting (Visual Studio). But it probably
doesn't make a difference. Anyway you should always use the
binaries, libraries and headers from a single toolchain (either
use the PSDK compiler and headers or use Visual Studio
compiler and headers)

I compiled ipl98_visualc.lib with the very same compiler (but not
cameras_ipl98.lib).
All of your contributing libraries and object files should be built
with the same compiler version and settings.

However, the error message suggests otherwise.

What it says is:

The linker selects complex_image.obj from ipl98_visualc.lib to
satisfy some other reference. complex_image.cpp (or whatever
source file was used to build complex_image.obj) references

std::operator<< <>( std::ostream&, const char*)

(That's required if you do something like std::cout << "snoopy")

which was declared as __declspec(dllimport).

That really suggest that it was not built with correct header files
because this operator is never imported in Visual C++ 2005
but is always inline regardless of the runtime library linkage
model.

So the question is: how do you build complex_image.obj?

-hg


.



Relevant Pages

  • Re: Compiling Problem with LibCurl
    ... containing object files and hence shouldn't be included on the CC line. ... The LINK command is then used to link the object files and libraries. ... The C compiler has a process for finding include files. ...
    (comp.os.vms)
  • Re: Object files
    ... Put floppy disk in computer. ... > brand of compiler, linker or another version of the same compiler. ... of software in object or library (collection of object files) form, ... dozens of libraries supplied in object form, ...
    (comp.lang.c)
  • Re: Compiling Problem with LibCurl
    ... containing object files and hence shouldn't be included on the CC line. ... The LINK command is then used to link the object files and libraries. ... So i don't how i can produce the .obj file if the compiler don't ...
    (comp.os.vms)
  • Re: Compiling Problem with LibCurl
    ... containing object files and hence shouldn't be included on the CC line. ... The LINK command is then used to link the object files and libraries. ... So i don't how i can produce the .obj file if the compiler don't ...
    (comp.os.vms)
  • Re: Partitioning SATA disk
    ... with the sole exception of when you are bootstrapping a kernel, when you are expecting to compile any libraries, and they are associated with the source files of such. ... Headers go with source files or with precompiled source files that are not yet linked = libraries. ... The compiler, the kernel development source and ITS headers and the OS libraries and THEIR headers are not a one package thing: I can think of many examples where you might want the compiler alone. ...
    (comp.os.linux.setup)