0

I have 2 projects. I'm using VC++ 2010 express.

The first is a static library which generates a lib file called stdlib.lib.
The second is a dll project which links to stdlib.lib.

When I try to compile, I get linker errors that say unresolved reference and they refer
to functions that are inside stdlib.lib. I have no idea why this is happening because
I've linked in stdlib.lib.

This is some of the code from stdlib.lib(too much to show all):

#ifndef KEYVALUE_H
#define KEYVALUE_H
#ifdef _WIN32
#pragma once
#endif

#include "utlvector.h"
#include "ifilesystem.h"

#define MAX_IDENTIFIER_LENGTH 256
#define MAX_VALUE_LENGTH 1024

class KeyValue{
	char m_pIdentifier[MAX_IDENTIFIER_LENGTH];
	char m_pValue[MAX_VALUE_LENGTH];
	bool m_bParseSubKeys;
	CUtlVector< KeyValue > m_SubKeys;
public:
	KeyValue( void );
	KeyValue( char *pFilename, IBaseFileSystem *pFileSystem );
	KeyValue( int nFileHandle, IBaseFileSystem *pFileSystem );
	~KeyValue( void );

	void Reset( void );
	void Cleanup( void );

	char *GetIdentifier( void );
	char *GetValue( void );
	CUtlVector< KeyValue > &GetSubKeys( void );

	bool ParseFromFile( int nFileHandle, IBaseFileSystem *pFileSystem );
	bool ParseFromFile( char *pFilename, IBaseFileSystem *pFileSystem );
	bool ParseFromFileManual( char *pFilename, IBaseFileSystem *pFileSystem );
	bool ParseFromString( char *pString, bool *bGetNext = NULL );

	KeyValue GetSubKey( char *pSubKeyName );
	KeyValue GetSubKey( int nIndex );
	char *GetSubKeyValue( char *pSubKeyName );
	char *GetSubKeyValue( int nIndex );

	int IndexOf( char *pSubKeyName );

	int NumSubKeys( void );

	bool IsParsingSubKeys( void );

	bool operator==( KeyValue &other );

	bool IsValidIndex( int nIndex );
	bool ValidateKeyname( char *pName );
};

#endif

Here is some code that uses it from the dll:

KeyValue kGameData;
	kGameData.ParseFromFileManual( "gameinfo.txt", filesystem );

	char *pGameDir = kGameData.GetSubKeyValue( "game" );

	if( !pGameDir )
		pGameDir = "charge";

Edited by tomtetlaw: n/a

5
Contributors
8
Replies
9
Views
5 Years
Discussion Span
Last Post by mitrmkar
0

Do all functions from stdlib.lib give you a linker error?

On a side note, Ed does not get warm and fuzzies from the name "stdlib.lib" because there is already a compiler-supported stdlib.h, which might have a corresponding stdlib.lib.

0

Not all of them, just those inside the KeyValue class. I'll try naming it something else then compiling.

EDIT: Just tried renaming but still got the same errors.

Edited by tomtetlaw: n/a

0

> Not all of them, just those inside the KeyValue class.
Are you sure all of the methods are implemented and everything is being exported to the DLL?

0

All the methods are being implemented, I just double checked :)
I'm not sure if they are being exported but I looked inside the .lib file and the KeyValue methods are there. Is there anything I need to do to the dll/the dll project to get it to work?

EDIT: I just did a ctrl+f in notepad when I opened the .lib file and it couldn't find the text 'KeyValue' would this mean they're not being exported?

Edited by tomtetlaw: n/a

0

Can you post the linker errors? Also the command lines (from the VS build logs).

--edit--
And certainly DO NOT use stdlib as the name!! As already said by Ed..
Don't post the errors unless you've changed the name.

Edited by thekashyap: n/a

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.