473,413 Members | 1,993 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

link error problem because of decorated names

Hello!

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 :

*****
testlib.h:
#pragma once
class CTestLib
{
public:
CTestLib(void){}
~CTestLib(void){}

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

****
testlib.cpp:
#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 :

****
test.h:
void coucou(LPVOID t);

****
test.cpp:
#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 *)"
(?coucou@@YAXPAX@Z)"

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 !!!!!!

Nov 22 '05 #1
0 830

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Suzanne | last post by:
Hi++, I get a link error when I try to call a template function that is declared in a header file and defined in a non-header file. I do *not* get this link error if I define the template...
0
by: david | last post by:
Hello! 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...
1
by: Peter | last post by:
Hi, I got the following link error in my release build (I am using vc7 on WinXP): ----------------------------------------- Linking... LINK : error LNK2020: unresolved token (0A000020)...
4
by: Rafi Kfir | last post by:
"Hi, This is a very simple question that confuses me (probably due to some lack of knowledge...) I will illustrate my problem with a smiple example: My project has the following files:
5
by: sriram | last post by:
I have the following: class BSA { ... ... ... ... public: enum VRGAttrId {
10
by: Gary Hughes | last post by:
I'm getting the following error when attempting to link a managed C++ dll. I can't find any reference to these errors with google. Can anyone help? I've included the class definition causing the...
0
by: AntonB | last post by:
I am using Visual Studio 2005 Beta1 and get the following errors when building a .NET class library (called TryDLLPr in the example below). Any advice on what's wrong will be greatly appreciated. ...
4
by: Jun | last post by:
anyone know how this error shows? how can i solve this? LINK : error LNK2020: unresolved token (0A0000EA) _AtlBaseModule LINK : error LNK2020: unresolved token (0A0000EC) atlTraceGeneral LINK :...
9
by: Michael Tissington | last post by:
After converting from 6.0 to 2005 when I try to Compile my project I'm getting a LINK error Error 1 fatal error LNK1181: cannot open input file " ?/.obj" Any ideas how to fx this please ? ...
5
by: kevin0608 | last post by:
when i using the VS 2005 , There is an Link Error like this: ------------------------------------------------------------------------------------ Compiling... test.c Linking... LINK : fatal...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.