Click to See Complete Forum and Search --> : error LNK2001: unresolved external symbol


garryMarshall
January 21st, 2005, 03:30 PM
My code under VS7.0 works under debug mode. But when I change it to Release mode two out of four methods in my class can not link. I have included part of that code.
------ Build started: Project: ManBase, Configuration: Release Win32 ------

Deleting intermediate files and output files for project 'ManBase', configuration 'Release|Win32'.
Compiling...
UnmanagedBase.cpp
ManBase.cpp
AssemblyInfo.cpp
Generating Code...
Compiling resources...
Linking...
ManBase.obj : error LNK2001: unresolved external symbol "public: unsigned int __thiscall UnmanagedRtc::GetMaxEncryptedSize(unsigned int)" (?GetMaxEncryptedSize@UnmanagedRtc@@$$FQAEII@Z)
ManBase.obj : error LNK2001: unresolved external symbol "public: unsigned int __thiscall UnmanagedRtc::GetDecryptedSize(unsigned char const *,unsigned int,unsigned int *)" (?GetDecryptedSize@UnmanagedRtc@@$$FQAEIPBEIPAI@Z)
./win32_release\Base.dll : fatal error LNK1120: 2 unresolved externals


ManBase - 3 error(s), 0 warning(s)


---------------------- Done ----------------------

Build: 0 succeeded, 1 failed, 0 skipped

// this is the .h file
#pragma once
#include <stdint.h>


__nogc class UnmanagedRtc
{
public:
UnmanagedRtc();
~UnmanagedRtc();

int Decrypt(const uint8_t *inbuf, size_t uInSize, uint16_t *outbuf, size_t *puOutSize);
int Encrypt( const uint16_t *source, size_t uInSize, uint8_t *dest, size_t *outSize );

size_t GetDecryptedSize(const uint8_t *inbuf, size_t uInSize, size_t *puOutSize);
size_t GetMaxEncryptedSize( size_t size);

private:

};

// this is the .cpp file without the constructor

int UnmanagedRtc::Decrypt(const uint8_t *inbuf, size_t uInSize, uint16_t *outbuf, size_t *puOutSize)
{
return Rtc::DecryptW(inbuf, uInSize, outbuf, puOutSize);
}

int UnmanagedRtc::Encrypt( const uint16_t *source, size_t uInSize, uint8_t *dest, size_t *outSize )
{
return Rtc::EncryptW(source, uInSize, dest, outSize);
}

size_t UnmanagedRtc::GetDecryptedSize(const uint8_t *inbuf, size_t uInSize, size_t *puOutSize)
{
return Rtc::GetDecryptedSize(inbuf, uInSize, puOutSize);
}

size_t UnmanagedRtc::GetMaxEncryptedSize( size_t size)
{
return Rtc::GetMaxEncryptedSizeW(size);
}


Any help would be appreciated.
Thanks, Garry

coder0xff
January 21st, 2005, 06:51 PM
Does the .cpp file have the .h #included? I noticed that the compiler error is showing all the size_t's as unsigned int's. Have you tried changing all the size_t's to unsigned int's to see if it atleast allows the module to compile?

garryMarshall
January 24th, 2005, 02:18 PM
Yes the .cpp does include the .h #include. The code does compile in release mode but does not link. The same code in debug mode compiles, links and runs with no problem. I did change the size_t to int and it still does not link in the releaser version.
Thanks for help, garry

Andreas Masur
January 24th, 2005, 02:56 PM
Well...trying the obvious....did you compare the linker settings for both debug and release?

garryMarshall
January 24th, 2005, 03:04 PM
Yes, I compared all of the settings between the debug and release versions. The only difference is where it has to be different, which isn't very many places.
Thanks, Garry