C++ LNK2019 ( between project classes ) - c++

I have an very strange error: when I want to use the SocialServer::Client class from my SocialServer::Server class, the linker threw me two LNK2019 errors :
Error 1 error LNK2019: unresolved external symbol "public: void __thiscall SocialServer::Client::Handle(void)" (?Handle#Client#SocialServer##QAEXXZ) referenced in function "private: static unsigned int __stdcall SocialServer::Server::listenThread(void *)" (?listenThread#Server#SocialServer##CGIPAX#Z) C:\Users\benjamin\Documents\Visual Studio 2010\Projects\FCX Social Server\SocialServer Core\Server.obj SocialServer Core
Error 2 error LNK2019: unresolved external symbol "public: __thiscall SocialServer::Client::Client(unsigned int)" (??0Client#SocialServer##QAE#I#Z) referenced in function "private: static unsigned int __stdcall SocialServer::Server::listenThread(void *)" (?listenThread#Server#SocialServer##CGIPAX#Z) C:\Users\benjamin\Documents\Visual Studio 2010\Projects\FCX Social Server\SocialServer Core\Server.obj SocialServer Core
However , these 2 missing function are correctly implemented :
Client.h
#pragma once
#include "dll.h"
namespace SocialServer
{
class __social_class Client
{
public:
Client(SOCKET sock);
~Client();
void Handle();
private:
static unsigned __stdcall clientThread(void* value);
SOCKET _socket;
uintptr_t _thread;
unsigned int _thread_id;
};
}
Client.cpp
#pragma once
#include "Client.h"
namespace SocialServer
{
Client::Client(SOCKET socket)
{
this->_socket = socket;
}
Client::~Client()
{
}
void Client::Handle()
{
std::cout << " New client " << std::endl;
this->_thread = _beginthreadex(NULL, 0, Client::clientThread, &this->_socket, CREATE_SUSPENDED, &this->_thread_id);
ResumeThread((HANDLE)this->_thread);
}
unsigned __stdcall Client::clientThread(void* value)
{
// Some code to execute here ...
}
}
Where does the problem comes from ?

i've found the solution.
In a function that's used by _beginthreadex() (with unsigned __stdcall) , always add a return at the end.

Related

unresolved external symbol "__declspec(dllimport)"

I'm trying to code a little plugin for bakkesmod because I'm pissing myself off.
I watched the only 2 video that exists on this topic but ... it doesn't work and I have this error for each void - >> Severity Code Description Project File Line Suppression State
Error LNK2001 unresolved external symbol "__declspec(dllimport) public: void __thiscall GameWrapper::HookEvent(class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::function<void __cdecl(class std::basic_string<char,struct std::char_traits,class std::allocator >)>)" (_imp?HookEvent#GameWrapper##QAEXV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##V?$function#$$A6AXV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z#3##Z) TagName C:\Users\leodu\source\repos\TagName\TagName\TrollTagName.obj 1
here is my code.
TroolTagName.cpp (not judge the name)
#include "TrollTagName.h"
BAKKESMOD_PLUGIN(TroolTagName, "Trool Tag Name", "1.0", PERMISSION_ALL)
void TroolTagName::onLoad()
{
this->Log("This is my first Bakkesmod Plugin");
this->LoadHooks();
}
void TroolTagName::onUnload()
{
}
void TroolTagName::LoadHooks()
{
gameWrapper->HookEvent("Function TAGame.GameEvent_Soccar_TA.EventMatchEnded", std::bind(&TroolTagName::GameEndedEvent, this, std::placeholders::_1));
gameWrapper->HookEvent("Function TAGame.AchievementManager_TA.HandleMatchEnded", std::bind(&TroolTagName::GameEndedEvent, this, std::placeholders::_1));
}
void TroolTagName::GameEndedEvent(std::string name)
{
cvarManager->executeCommand("load_freeplay");
}
void TroolTagName::Log(std::string msg)
{
cvarManager->log("TroolTagName: " + msg);
}
TroolTagName.h
#include "bakkesmod\plugin\bakkesmodplugin.h"
#pragma comment(lib, "pluginsdk.lib")
class TroolTagName : public BakkesMod::Plugin::BakkesModPlugin
{
public:
virtual void onLoad();
virtual void onUnload();
void LoadHooks();
void GameEndedEvent(std::string name);
private:
void Log(std::string msg);
};
The project and a Dynamic-library dll project.
I tried adding __declspec (dllexport) before void but ... I got this error - >> redefinition; different linkage and I found nothing for this error so I am blocked :(

Linker can't find a namespace's functions

See code below. There's something wrong with it, because the linker is complaining it can't find the Memory's functions, but I can't figure out why.
memory.h
#pragma once
#include "includes.h" //it just includes other strandard headers.
class MemoryUnit
{
public:
MemoryUnit() {}
virtual int getValue() = 0;
virtual int getSize() = 0;
virtual void setValue(int) = 0;
virtual ~MemoryUnit() {};
};
class Byte : public MemoryUnit
{
int value;
public:
static int size;
Byte(int byte) :value(byte) {};
int getSize() { return size; }
int getValue() { return value; };
void setValue(int byte) { value = byte; }
~Byte() {};
};
namespace Memory
{
extern int size;
extern MemoryUnit** map;
void checkAddress(int address);
int read(int adress);
MemoryUnit* getOperation(int address);
void write(int adress, MemoryUnit* data);
void writeByte(int adress, int data);
}
memory.cpp
#include "includes.h"
#include "memory.h"
#include "simulator.h" // it contains only externed constants.
namespace Memory
{
int size = 0;
MemoryUnit** map = NULL;
inline MemoryUnit* getOperation(int address)
{
return map[address];
}
inline void checkAddress(int address)
{
if (address < 0 || address >= MAX_MEMORY_SIZE)
throw std::out_of_range("Invalid memory address.");
}
inline int read(int address)
{
checkAddress(address);
return map[address]->getValue();
}
inline void write(int address, MemoryUnit* data)
{
checkAddress(address);
delete map[address];
map[address] = data;
}
inline void writeByte(int address, int data)
{
checkAddress(address);
map[address]->setValue(data);
}
}
Everywhere the class/namespace memory.h declares is includes memory.h. Is here anything wrong in the code below?
Edit:
I'm using Visual Studio 2015.
Errors I got when building the project:
LNK1120 5 unresolved externals simulator.exe
LNK2019 unresolved external symbol "void __cdecl Memory::writeByte(int,int)" referenced in function "void __cdecl ALU::setFlags(int)" alu.obj
LNK2001 unresolved external symbol "void __cdecl Memory::writeByte(int,int)" cu.obj
LNK2019 unresolved external symbol "class MemoryUnit * __cdecl Memory::getOperation(int)" referenced in function "void __cdecl CU::run(void)" cu.obj
LNK2001 unresolved external symbol "void __cdecl Memory::writeByte(int,int)" helpers.obj
LNK2019 unresolved external symbol "void __cdecl Memory::write(int,class MemoryUnit *)" referenced in function "void __cdecl readProgramCommands(void)" helpers.obj
LNK2001 unresolved external symbol "public: virtual int __thiscall MemoryPointer::getValue(void)" helpers.obj
LNK2001 unresolved external symbol "public: virtual int __thiscall IndirectMemoryPointer::getAddress(void)" helpers.obj
LNK2001 unresolved external symbol "void __cdecl Memory::writeByte(int,int)" main.obj
alu.h and alu.cpp for the first error:
//alu.h
#pragma once
#include "includes.h"
#include "operation.h"
namespace ALU
{
int operation(Operation* op);
void setFlags(int result);
}
//alu.cpp
#include "includes.h"
#include "simulator.h"
#include "alu.h"
#include "memory.h"
#include "operation.h"
namespace ALU
{
int operation(Operation* operation)
{
// ...
setFlags(result);
return result;
}
inline void setFlags(int result)
{
Memory::writeByte(FLAG_Z, result == 0);
// ...
}
}
You need to put the inline function definition inside your header file (they both must appear in every translation unit where they are used), you can separate declaration and definition but both must be in the header file. Also they must be declared as inline.
N4140 dcl.fct.spec 7.1.2.4
An inline function shall be defined in every translation unit in which it is odr-used and shall have exactly
the same definition in every case (3.2). [ Note: A call to the inline function may be encountered before its
definition appears in the translation unit. —end note ] If the definition of a function appears in a translation
unit before its first declaration as inline, the program is ill-formed.
When you're using inline functions or methods, their definitions should be visible for every source unit that uses them. You defined your inline functions in Memory.cpp, that's why you get 'unresolved' linker error.
To fix your problem you can:
Remove inline modifier and keep functions definitions in Memory.cpp.
Keep inline modifier but move functions definitions to Memory.h.

Loki's SmallObjAllocator of of memory

#include "stdafx.h" //In order to use Visual C++
#include <iostream>
#include <Loki\SmallObj.h> //The header file to manage
// smalls objects allocator
class MySmallObj : public Loki::SmallObjAllocator //inherit from the base
//class SmallObjAllocator
{
public:
MySmallObj():SmallObjAllocator(sizeof(char), sizeof(long),0){};
};
int _tmain(int argc, _TCHAR* argv[])
{
MySmallObj * premier = new MySmallObj; //declaring my object derived from smallobjallcator
char * myChar = static_cast<char*>( premier->Allocate(1, true)); //calling allocate from my object and conveting the void pointer to char*
premier.Deallocate(myChar, 1);
return 0;
}
The loki library uses essentially generic programming in c++
I have got the code up there using Small object allocator of memory(Loki::SmallObjAllocator)
I m using visual c++ 2010
I get those errors:
> MyLoki.cpp
1>MyLoki.obj : error LNK2019: unresolved external symbol "public: void __thiscall Loki::SmallObjAllocator::Deallocate(void *,unsigned int)" (?Deallocate#SmallObjAllocator#Loki##QAEXPAXI#Z) referenced in function _wmain
1>MyLoki.obj : error LNK2019: unresolved external symbol "public: void * __thiscall Loki::SmallObjAllocator::Allocate(unsigned int,bool)" (?Allocate#SmallObjAllocator#Loki##QAEPAXI_N#Z) referenced in function _wmain
1>MyLoki.obj : error LNK2019: unresolved external symbol "protected: __thiscall Loki::SmallObjAllocator::SmallObjAllocator(unsigned int,unsigned int,unsigned int)" (??0SmallObjAllocator#Loki##IAE#III#Z) referenced in function "public: __thiscall MySmallObj::MySmallObj(void)" (??0MySmallObj##QAE#XZ)
I have founded an answer to my first question.
#include "stdafx.h" //In order to use Visual C++
#include <iostream>
#include <Loki\SmallObj.h> //The header file to manage
// smalls objects allocator
class MySmallObj : public Loki::SmallObjAllocator //inherit from the base
//class SmallObjAllocator
{
public:
MySmallObj():SmallObjAllocator(sizeof(char), sizeof(long),1){}; //the chunkSize < maxObjsize
};
int _tmain(int argc, _TCHAR* argv[])
{
MySmallObj * premier = new MySmallObj; //declaring my object derived from smallobjallcator
char * myChar = static_cast<char*>( premier->Allocate(1, true)); //calling allocate from my object and conveting the void pointer to char*
premier->Deallocate(myChar, 1);
return 0;
}
the errors of multiple
unresolved external symbol
are because of SmallObj.cpp , of Loki that was not included to the project
for example of Loki::SmallObjAllocator, Loki::SmallObject here

Singleton causing linker errors: "already defined"

I wrote a simple class which manages the current execution session. Therefore, I decided to use a singleton pattern but the compilation crashes at linked step. This is the error:
error LNK2005: "class Session * session" (?session##3PAVSession##A) already defined in ClientTsFrm.obj
(...)client\FrmSaveChat.obj TeamTranslate
error LNK2005: "class Session * session" (?session##3PAVSession##A) already defined in ClientTsFrm.obj
(...)client\Login.obj TeamTranslate
error LNK2019: unresolved external symbol "protected: __thiscall Session::Session(void)" (??0Session##IAE#XZ)
referenced in function "public: static class Session * __cdecl Session::Instance(void)" (?Instance#Session##SAPAV1#XZ)
(...)client\Session.obj TeamTranslate
error LNK2001: unresolved external symbol "private: static char const * const Session::_nick" (?_nick#Session##0PBDB)
(...)client\Session.obj TeamTranslate
error LNK2001: unresolved external symbol "private: static char const * const Session::_service" (?_service#Session##0PBDB)
(...)client\Session.obj TeamTranslate
error LNK2001: unresolved external symbol "private: static char const * const Session::_serverAddress" (?_serverAddress#Session##0PBDB)
(...)client\Session.obj TeamTranslate
error LNK2001: unresolved external symbol "private: static char const * const Session::_googleAPI" (?_googleAPI#Session##0PBDB)
(...)client\Session.obj TeamTranslate
error LNK2001: unresolved external symbol "private: static char const * const Session::_language" (?_language#Session##0PBDB)
(...)client\Session.obj TeamTranslate
error LNK2001: unresolved external symbol "private: static int Session::_numbLanguageSelected" (?_numbLanguageSelected#Session##0HA)
(...)client\Session.obj TeamTranslate
error LNK2001: unresolved external symbol "private: static char const * const Session::_translationEngine" (?_translationEngine#Session##0PBDB)
(...)client\Session.obj TeamTranslate
error LNK1120: 8 unresolved externals
(...)client\bin\TeamTranslate.exe TeamTranslate
IntelliSense: identifier "wxZipStreamLink" is undefined
(..)\include\wx\zipstrm.h 417 5
session.h (singleton)
#ifndef __SESSION_H__
#define __SESSION_H__
#include <cstring>
#include <stdio.h>
class Session {
public:
static Session* Instance();
void setNick(char* nick);
const char* getNick();
void setService(char* serv);
const char* getService();
void setLanguage(char* lang);
const char* getLanguage();
const char* getServerAddress();
void setServerAddress(char *sv);
void setGoogleAPIKey(char* code);
const char* getGoogleAPIKey();
void setNumbLanguageSelected(int v);
int getNumbLanguageSelected();
const char* Session::getTranslationEngine();
void Session::setTranslationEngine(char *sv);
char* Session::getGoogleURLTranslation();
void update();
bool read();
protected:
Session();
private:
static Session* _instance;
static const char* _nick; // client nickname
static const char* _service; // service used to translation (Google, Bing,....)
static const char* _serverAddress;
static const char* _googleAPI;
static const char* _language;
static int _numbLanguageSelected;
static const char* _translationEngine;
};
#endif
Session.cpp
#include "Session.h"
Session* Session::_instance = 0;
Session* Session::Instance() {
if (_instance == 0) {
_instance = new Session;
_instance->read();
}
return _instance;
}
void Session::setGoogleAPIKey(char* code){
_googleAPI = strdup(code);
}
const char* Session::getGoogleAPIKey(){
return _googleAPI;
}
void Session::setLanguage(char* lang){
_language = strdup(lang);
}
const char* Session::getLanguage(){
return _language;
}
void Session::setNick(char* nick){
_nick = strdup(nick);
}
const char* Session::getNick(){
return _nick;
}
void Session::setService(char* serv){
_service = strdup(serv);
}
const char* Session::getService(){
return _service;
}
const char* Session::getServerAddress(){
return _serverAddress;
}
void Session::setServerAddress(char *sv){
_serverAddress = strdup(sv);
}
void Session::setNumbLanguageSelected(int v){
this->_numbLanguageSelected = v;
}
int Session::getNumbLanguageSelected(){
return _numbLanguageSelected;
}
const char* Session::getTranslationEngine(){
return _translationEngine;
}
void Session::setTranslationEngine(char* sv){
_translationEngine = strdup(sv);
}
void Session::update(){
FILE* config = fopen("conf\\config.txt", "w");
fprintf(config, "%s\n", _serverAddress);
fprintf(config, "%s\n", _nick);
fprintf(config, "%d\n", _numbLanguageSelected);
fprintf(config, "%s\n", _language);
fprintf(config, "%s", _translationEngine);
fflush(config);
fclose(config);
}
bool Session::read(){
FILE * config;
if (config = fopen("conf\\config.txt", "r"))
{
fscanf(config, "%s", _serverAddress);
fscanf(config, "%s", _nick);
fscanf(config, "%d", _numbLanguageSelected);
fscanf(config, "%s", _language);
fscanf(config, "%s", _translationEngine);
fflush(config);
fclose(config);
return true;
} else
return false;
}
char* Session::getGoogleURLTranslation(){
return "https://www.googleapis.com/language/translate/v2?key=";
}
Example about how I call the singleton:
#include "../data/Session.h"
static Session* session = Session::Instance();
Can you help me to fix the errors?
thanks in advance.
One of your headers (which you didn't show, but it is included in both "ClientTsFrm.cpp" and "FrmSaveChat.cpp") defines a variable called "session" of type Session*.
The other errors are caused by your forgetting to define most static members of Session.

C++ : Why am i getting Linker errors? [duplicate]

This question already has an answer here:
C and hashlib LNK errors
(1 answer)
Closed 9 years ago.
Note that i am using Windows Forms Applications with the .NET
Here is my code:
#pragma once
#include <cstdlib>
#include <Windows.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <cstring>
#include <iostream>
#include <vcclr.h>
#include <hashlibpp.h>
namespace Launcher {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Diagnostics;
using namespace MySql::Data::MySqlClient;
using namespace std;
using namespace System::Runtime::InteropServices;
/// <summary>
/// Summary for Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
//Component properties (not important)
}
#pragma endregion
void convert(String^ total1, char *ch){ //Converts string to const char*
// Pin memory so GC can't move it while native function is called
pin_ptr<const wchar_t> c1 = PtrToStringChars(total1);
printf_s("%S\n", c1);
// Conversion to char* :
// Can just convert wchar_t* to char* using one of the
// conversion functions such as:
// WideCharToMultiByte()
// wcstombs_s()
// ... etc
size_t convertedChars = 0;
size_t sizeInBytes = ((total1->Length + 1) * 2);
errno_t err = 0;
ch = (char *)malloc(sizeInBytes);
err = wcstombs_s(&convertedChars,
ch, sizeInBytes,
c1, sizeInBytes);
if (err != 0)
printf_s("wcstombs_s failed!\n");
printf_s("%s\n", ch);
}
void MarshalString ( String ^ s, string& os ) { //Another converter
using namespace Runtime::InteropServices;
const char* chars =
(const char*)(Marshal::StringToHGlobalAnsi(s)).ToPointer();
os = chars;
Marshal::FreeHGlobal(IntPtr((void*)chars));
}
void MarshalString ( String ^ s, wstring& os ) { //Another converter
using namespace Runtime::InteropServices;
const wchar_t* chars =
(const wchar_t*)(Marshal::StringToHGlobalUni(s)).ToPointer();
os = chars;
Marshal::FreeHGlobal(IntPtr((void*)chars));
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
//I removed some other functions from here because they are blank
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
//MySQL variables
try{
conDataBase->Open();
myReader=cmdDataBase->ExecuteReader();
while(myReader->Read()){
String^ atmp_user = textBox1->Text;
String^ user = (myReader->GetString(1));//Gets Usernames from database
String^ atmp_pass = textBox2->Text;
String^ pass = (myReader->GetString(2));//Gets Passwords from database
atmp_pass->ToLower();//Lower Case's variable
atmp_user->ToLower();
String^ total1 = gcnew String(atmp_user+atmp_pass);//Combines 2 strings
string totala;//std::string
MarshalString(total1, totala);//Copies data from (total1) to (totala)
hashwrapper *myWrapper = new sha1wrapper();//SHA1 hashing begins
string hash1 = myWrapper->getHashFromString(totala);//creates new variable(hash1) and copies data from (totala)
String^ finalpass;//Creates new System::String
MarshalString(finalpass, hash1);//Copies data from (hash1) to (finalpass)
delete myWrapper;//Ends SHA1 hashing
//Login Script
if(atmp_user == user && finalpass == pass){
textBox1->Text = ("It worked!");
}
}
} catch(Exception^ex) {
MessageBox::Show(ex->Message);
}
}
//Other blank functions created
};
}
Here are the errors:
Error 4 error LNK2028: unresolved token (0A0000D5) "public: __clrcall md5wrapper::md5wrapper(void)" (??0md5wrapper##$$FQAM#XZ) referenced in function "public: class hashwrapper * __clrcall wrapperfactory::create(enum HL_Wrappertype)" (?create#wrapperfactory##$$FQAMPAVhashwrapper##W4HL_Wrappertype###Z) C:\Users\Jeremy\Documents\Visual Studio 2010\Projects\Launcher\Launcher\hl_wrapperfactory.obj
Error 3 error LNK2028: unresolved token (0A00009D) "public: __clrcall sha384wrapper::sha384wrapper(void)" (??0sha384wrapper##$$FQAM#XZ) referenced in function "public: class hashwrapper * __clrcall wrapperfactory::create(enum HL_Wrappertype)" (?create#wrapperfactory##$$FQAMPAVhashwrapper##W4HL_Wrappertype###Z) C:\Users\Jeremy\Documents\Visual Studio 2010\Projects\Launcher\Launcher\hl_wrapperfactory.obj
Error 2 error LNK2028: unresolved token (0A000094) "public: __clrcall sha512wrapper::sha512wrapper(void)" (??0sha512wrapper##$$FQAM#XZ) referenced in function "public: class hashwrapper * __clrcall wrapperfactory::create(enum HL_Wrappertype)" (?create#wrapperfactory##$$FQAMPAVhashwrapper##W4HL_Wrappertype###Z) C:\Users\Jeremy\Documents\Visual Studio 2010\Projects\Launcher\Launcher\hl_wrapperfactory.obj
Error 1 error LNK2028: unresolved token (0A00005B) "public: __clrcall sha256wrapper::sha256wrapper(void)" (??0sha256wrapper##$$FQAM#XZ) referenced in function "public: class hashwrapper * __clrcall wrapperfactory::create(enum HL_Wrappertype)" (?create#wrapperfactory##$$FQAMPAVhashwrapper##W4HL_Wrappertype###Z) C:\Users\Jeremy\Documents\Visual Studio 2010\Projects\Launcher\Launcher\hl_wrapperfactory.obj
Error 5 error LNK2019: unresolved external symbol "public: __clrcall sha512wrapper::sha512wrapper(void)" (??0sha512wrapper##$$FQAM#XZ) referenced in function "public: class hashwrapper * __clrcall wrapperfactory::create(enum HL_Wrappertype)" (?create#wrapperfactory##$$FQAMPAVhashwrapper##W4HL_Wrappertype###Z) C:\Users\Jeremy\Documents\Visual Studio 2010\Projects\Launcher\Launcher\hl_wrapperfactory.obj
Error 6 error LNK2019: unresolved external symbol "public: __clrcall sha384wrapper::sha384wrapper(void)" (??0sha384wrapper##$$FQAM#XZ) referenced in function "public: class hashwrapper * __clrcall wrapperfactory::create(enum HL_Wrappertype)" (?create#wrapperfactory##$$FQAMPAVhashwrapper##W4HL_Wrappertype###Z) C:\Users\Jeremy\Documents\Visual Studio 2010\Projects\Launcher\Launcher\hl_wrapperfactory.obj
Error 7 error LNK2019: unresolved external symbol "public: __clrcall sha256wrapper::sha256wrapper(void)" (??0sha256wrapper##$$FQAM#XZ) referenced in function "public: class hashwrapper * __clrcall wrapperfactory::create(enum HL_Wrappertype)" (?create#wrapperfactory##$$FQAMPAVhashwrapper##W4HL_Wrappertype###Z) C:\Users\Jeremy\Documents\Visual Studio 2010\Projects\Launcher\Launcher\hl_wrapperfactory.obj
Error 8 error LNK2019: unresolved external symbol "public: __clrcall md5wrapper::md5wrapper(void)" (??0md5wrapper##$$FQAM#XZ) referenced in function "public: class hashwrapper * __clrcall wrapperfactory::create(enum HL_Wrappertype)" (?create#wrapperfactory##$$FQAMPAVhashwrapper##W4HL_Wrappertype###Z) C:\Users\Jeremy\Documents\Visual Studio 2010\Projects\Launcher\Launcher\hl_wrapperfactory.obj
Error 9 error LNK1120: 8 unresolved externals C:\Users\Jeremy\Documents\Visual Studio 2010\Projects\Launcher\Debug\Launcher.exe 1
I don't understand these so i hope you guys can. Btw i am using the hashlib++ library in this project for the SHA1 hashing. I am assuming that's why there are so many references to it.
You need to link againts the library itself. In visual studio, go to project preferences, linker options, and choose the actual library you're using.
Here you can find an example with screenshoots on how it can be done.
This is a weird error I've run into. For some reason VC++ treats the methods as having __clrcall calling convention, even though they belong to unmanaged classes. I'm not sure what triggers it, it doesn't happen most of the time.
If all else fails, try explicitly marking methods of unmanaged classes (including constructors and destructors) with the __thiscall calling convention (which is the default for unmanaged methods):
class md5wrapper
{
public:
__thiscall md5wrapper();
__thiscall ~md5wrapper();
void __thiscall SomeMethod();
...