473,398 Members | 2,120 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,398 software developers and data experts.

Strange Unresolved External Problem

Greetings all,

I have a class which contains a function with the following signature:

MC_SDLImage* LoadImage(const std::string& file, int id);

and I call this function in two places in my code. For one of the calls
I am getting an unresolved external but it refers to the function as
"LoadImageA", notice the capital A on the end. Usually I can fix linker
errors pretty quickly but this one stumped me. In the end I tried
something weird... I changed the name of my function to be LoadImageA.
Now the call that was failing compiled, and the other call failed so I
had to change it to call LoadImageA and not LoadImage.

So I have two places in my code that call this function, ine one place
it calls it LoadImage and somewhere else it calls it LoadImageA. I was
pretty sure this was going to crash horribly once I was able to execute
it but it all works! This is the most bizarre thing I have ever seen
and I'm not comfortable with it at all!

Can anyone shed any light on this mystery? Many Thanks,

Caroline M.

Dec 9 '05 #1
5 1696
cm**********@btinternet.com wrote:
Greetings all,

I have a class which contains a function with the following signature:

MC_SDLImage* LoadImage(const std::string& file, int id);

and I call this function in two places in my code. For one of the calls
I am getting an unresolved external but it refers to the function as
"LoadImageA", notice the capital A on the end. Usually I can fix linker
errors pretty quickly but this one stumped me. In the end I tried
something weird... I changed the name of my function to be LoadImageA.
Now the call that was failing compiled, and the other call failed so I
had to change it to call LoadImageA and not LoadImage.

So I have two places in my code that call this function, ine one place
it calls it LoadImage and somewhere else it calls it LoadImageA. I was
pretty sure this was going to crash horribly once I was able to execute
it but it all works! This is the most bizarre thing I have ever seen
and I'm not comfortable with it at all!

Can anyone shed any light on this mystery? Many Thanks,

Caroline M.


Take a look at the preprocesses source code.

(Hint: #ifdef LoadImageA #undef LoadImageA #endif)

Stefan
--
Stefan Naewe
naewe.s_AT_atlas_DOT_de
Dec 9 '05 #2

<cm**********@btinternet.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
So I have two places in my code that call this function, ine one place
it calls it LoadImage and somewhere else it calls it LoadImageA. I was
pretty sure this was going to crash horribly once I was able to execute
it but it all works! This is the most bizarre thing I have ever seen
and I'm not comfortable with it at all!

Can anyone shed any light on this mystery? Many Thanks,


Sounds like you're using windows. Windows has some annoying
macros that rename functions based on whether you have unicode
enabled. IIRC it's done in windefs.h.
If LoadImage is your function rename it.
Dec 9 '05 #3
In message <11**********************@g47g2000cwa.googlegroups .com>,
cm**********@btinternet.com writes
Greetings all,

I have a class which contains a function with the following signature:

MC_SDLImage* LoadImage(const std::string& file, int id);

and I call this function in two places in my code. For one of the calls
I am getting an unresolved external but it refers to the function as
"LoadImageA", notice the capital A on the end. Usually I can fix linker
errors pretty quickly but this one stumped me. In the end I tried
something weird... I changed the name of my function to be LoadImageA.
Now the call that was failing compiled, and the other call failed so I
had to change it to call LoadImageA and not LoadImage.

So I have two places in my code that call this function, ine one place
it calls it LoadImage and somewhere else it calls it LoadImageA. I was
pretty sure this was going to crash horribly once I was able to execute
it but it all works! This is the most bizarre thing I have ever seen
and I'm not comfortable with it at all!

Can anyone shed any light on this mystery? Many Thanks,


Just a guess, but I suspect you are including, or failing to include,
some platform-dependent header which defines LoadImage() as a macro
(ugh, evil) mapping to either LoadImageA() or LoadImageW(), depending on
the setting of some other macro, to switch between normal and wide
character arguments.

--
Richard Herring
Dec 9 '05 #4
Ugh, yes you guys are right. I found the evil macro in winuser.h. I
renamed my function to Load_Image and all is well. Thanks all!

Caroline M.

Dec 9 '05 #5
cm**********@btinternet.com wrote:
Ugh, yes you guys are right. I found the evil macro in winuser.h. I
renamed my function to Load_Image and all is well. Thanks all!

Caroline M.


Very soon after i dealt with windows i decided i had enough of these
macro non-sense. So to end it all i use a different naming for ALL my
functions/classes. Perhaps you too can consider that as an option to
have an easier life?

Ben
Dec 9 '05 #6

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

Similar topics

4
by: Rodolphe | last post by:
Hello, I'm French so sorry for my approximate English. When I try to compile a project under Visual C++ 6.0, I've got the following errors : applicap.obj : error LNK2001: unresolved external...
0
by: Ida | last post by:
Hi, I am trying to build an dll with Microsoft Visual C++ but during the linking phase I get linking errors. Script.obj : error LNK2019: unresolved external symbol __imp__PyString_AsString...
1
by: Aravind | last post by:
we have two files: 1. rc4.c (defines one function "create_pin()") 2. MyImpl.c(calling the function "create_pin()"),This implements JNI method. 1.When I am trying to create .dll file with one...
5
by: cschettle | last post by:
I think you need to link with msvcrt.lib ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
6
by: sadegh | last post by:
Hi I have a problem with my program in VC++6 When I compile it, the following errors are listed. I spend a lot of time on the groups.google.com to find its reason, but none of comments could...
5
by: bonnielym84 | last post by:
Im new here..didnt noe whether is this the rite way to post my problem..Really need help here..i've been stucked in this error from last wk..My problem is like this..Im using VC++ 6.0 to compile my C...
0
by: bonnielym84 | last post by:
Im new here and im not sure whether is this the right place for me to post my question..anyway..hope that you can help me..i have been stucked in this problem since last wk..My problem is..I'm using...
0
by: Ryan Gaffuri | last post by:
hlink72@hotmail.com (Eric) wrote in message news:<ab8d8b14.0308220550.54fb5f22@posting.google.com>... LNK1120 is a standard C++ error. you using Visual C++? Means your references a class that...
2
by: =?Utf-8?B?YmFzaA==?= | last post by:
Hello, I am compiling a CPP code using Visual studion .net 2003. I get the following error, despite having windldap.h and wldap32.dll in my include and lib paths. Here is the error. uuid.lib...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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.