Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unresolved external symbol #3

Closed
GoogleCodeExporter opened this issue Mar 15, 2015 · 4 comments
Closed

unresolved external symbol #3

GoogleCodeExporter opened this issue Mar 15, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
Try to rebuild the simple test code (see below):

///////////////////////////////////main.cpp
#include <stdafx.h>
#include <rdestl/hash_map.h>

int main(int argc, char** argv)
{
    rde::hash_map<const char *, int, rde::hash<const char *>, 6> hashmap;

    hashmap["abc"] = 1;
    hashmap["def"] = 2;

    rde::hash_map<const char *, int, rde::hash<const char *>, 6>::iterator it
= hashmap.find("abc");
    if(it != hashmap.end())
        std::cout << it->second;

    return 0;
}

///////////////stdafx.h
#ifndef _STDAFX_H_
#define _STDAFX_H_

#pragma once

#include <iostream>

#endif

What is the expected output? What do you see 

Compilation without errors is expected instead I get an errors:

Error   1   error LNK2019: unresolved external symbol "public: void __thiscall
rde::allocator::deallocate(void *,unsigned int)"
(?deallocate@allocator@rde@@QAEXPAXI@Z) referenced in function "private:
void __thiscall rde::hash_map<char const *,int,struct rde::hash<char const
*>,6,struct rde::equal_to<char const *>,class
rde::allocator>::delete_nodes(void)"
(?delete_nodes@?$hash_map@PBDHU?$hash@PBD@rde@@$05U?$equal_to@PBD@2@Vallocator@2
@@rde@@AAEXXZ)
main.obj    rdestltest

Error   2   error LNK2019: unresolved external symbol "public: void *
__thiscall rde::allocator::allocate(unsigned int,int)"
(?allocate@allocator@rde@@QAEPAXIH@Z) referenced in function "private:
struct rde::hash_map<char const *,int,struct rde::hash<char const
*>,6,struct rde::equal_to<char const *>,class rde::allocator>::node *
__thiscall rde::hash_map<char const *,int,struct rde::hash<char const
*>,6,struct rde::equal_to<char const *>,class
rde::allocator>::allocate_nodes(int)"
(?allocate_nodes@?$hash_map@PBDHU?$hash@PBD@rde@@$05U?$equal_to@PBD@2@Vallocator
@2@@rde@@AAEPAUnode@12@H@Z)
main.obj    rdestltest

Error   3   fatal error LNK1120: 2 unresolved externals
C:\Projects\RoughSetLib\Debug\rdestltest.exe    rdestltest


What version of the product are you using? On what operating system?

Windows 7 Enterprise 64 bit
Microsoft Visual Studio Team System 2008 (development Edition) with SP1
installed

Please provide any additional information below.

I guess that it might be related to linker setup?
What is needed to compile this on MSVS 2008SP1 ?

Original issue reported on code.google.com by sebastia...@gmail.com on 8 Mar 2010 at 9:57

@GoogleCodeExporter
Copy link
Author

You need to link with rdestl.lib (there are several .cpp files in RDESTL).

Original comment by holorose on 13 Mar 2010 at 6:40

@GoogleCodeExporter
Copy link
Author

Original comment by holorose on 13 Mar 2010 at 6:41

  • Changed state: Verified

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author


Thank you for your answer. 
I've deleted my last comment as it had nothing to do with this issue (also when
posting it I did not see your answer - possibly we were posting it in the same 
time).
Linking with rdestl.lib did not change anything, RDESTL code was a separate 
project
in my MSVS solution and my project had a reference to it. Your suggestion make 
me
play with the configuration and what I've noticed is that I was using x64
configuration all the time. When switch to Win32 everything starts to work 
fine. 

Is it possible to compile RDESTL as 64 bit version (considering only the use of
hash_map)? I have noticed that in several files there is a note that "won't 
work on
64bit eg. vector.h) 

Best Regards,
Sebastian

Original comment by sebastia...@gmail.com on 15 Mar 2010 at 7:22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant