471,337 Members | 763 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

link error problem because of decorated names


I've a link error problem problem with VS .NET 2003.
I give you the complete description of a simple test (to simplify) :

First, I make a WIN32 static library supporting MFC and using precompiled
header. It contains :

#pragma once
class CTestLib

int gettruc(wchar_t const * truc);
int gettrucbis(int truc);

#include "StdAfx.h"
#include ".\testlib.h"
int CTestLib::gettruc(wchar_t const * truc)
return 0;
int CTestLib::gettrucbis(int truc)
return truc;

This project compiles and links.
In second time, I naturally want to use my static library... In fact, I need
it in a DLL. So my second project is a DLL MFC (normal dll using a MFC
shared DLL). I have a function which uses the object of my library :

void coucou(LPVOID t);

#include "stdafx.h"
#include "test.h"
#include "..\lib\testlib.h"
void coucou(LPVOID t)
CTestLib ti;
int i = ti.gettruc(NULL);
int i2 = ti.gettrucbis(2);

And I include the previous .lib file in the project options.
This project compile but does not link on ly for "gettruc" function:
"Création de la bibliothèque Debug/dll.lib et de l'objet Debug/dll.exp
test.obj : error LNK2019: symbole externe non résolu "public: int __thiscall
CTestLib::gettruc(wchar_t const *)" (?gettruc@CTestLib@@QAEHPB_W@Z)
référencé dans la fonction "void __cdecl coucou(void *)"

So it is surprising that with a int parameter, it works, but not with a
wchar_t parameter. And I have the same problem with other parameter :
LPCWSTR, CAtlStringW, CAtlArray, etc.

I noticed that the decorated name in the .lib generated in the first project
are not exactly the same that those generated in the second project to link
with the library. So It's normal that it doesn't link. But I don't know why
and how to cure this problem.

Thanks for your help !!!!!!

Jul 21 '05 #1
0 927

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jason Rowland | last post: by
3 posts views Thread by joseluismarchetti | last post: by
reply views Thread by Martin Aliger | last post: by
9 posts views Thread by Peter Oliphant | last post: by
4 posts views Thread by sbowman | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.