473,386 Members | 1,835 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,386 software developers and data experts.

Linker error LNK2001 with bools

Got a wierd one here.

I have a class function with 4 parameters, defined like

myclass::myfunc(size_t p1, size_t p2, size_t p3 = 1, bool p4 = TRUE)

If I then call that function like

myptr->myfunc(1,2,3,FALSE);

I get a link error..

myprog.obj : error LNK2001: unresolved external symbol "public: void
__thiscall myclass::myfunc(unsigned int,unsigned int,unsigned int,int)"
(?myfunc@myclass@@QAEXIIIH@Z)
Debug/myprog.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

rf_modem.exe - 2 error(s), 0 warning(s)

However, if I change the definition and implementation, changing the
bool to another unsigned int, it all builds without any problems.

Anyone got any comments on why this should be ? It's MS Visual C++ V6
Jul 22 '05 #1
3 1496

"Mike" <no****@nospam.com> wrote in message
news:GY***************@newsfe1-win.ntli.net...
Got a wierd one here.

I have a class function with 4 parameters, defined like

myclass::myfunc(size_t p1, size_t p2, size_t p3 = 1, bool p4 = TRUE)

If I then call that function like

myptr->myfunc(1,2,3,FALSE);

I get a link error..

myprog.obj : error LNK2001: unresolved external symbol "public: void
__thiscall myclass::myfunc(unsigned int,unsigned int,unsigned int,int)"
(?myfunc@myclass@@QAEXIIIH@Z)
Debug/myprog.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

rf_modem.exe - 2 error(s), 0 warning(s)

However, if I change the definition and implementation, changing the
bool to another unsigned int, it all builds without any problems.

Anyone got any comments on why this should be ? It's MS Visual C++ V6


Are you sure you are not mixing up bool and BOOL? You are definitely mixing
up false and FALSE, true and TRUE (it should be false and true).

Look out for #defines like this '#define bool int' or '#define bool BOOL'.
It's clear from your error message that your compiler is interpreting bool
as int. That could be because somewhere in your code you have #define bool
....

john
Jul 22 '05 #2
On Tue, 12 Oct 2004 11:10:30 +0000, Mike wrote:
Got a wierd one here. myclass::myfunc(size_t p1, size_t p2, size_t p3 = 1, bool p4 = TRUE)
You may want to use C++ by replacing 'TRUE' with 'true' here ..
myptr->myfunc(1,2,3,FALSE);
... and 'FALSE' with 'false' here.
However, if I change the definition and implementation, changing the bool
to another unsigned int, it all builds without any problems.

Anyone got any comments on why this should be ? It's MS Visual C++ V6


I assume TRUE and FALSE are of type unsigned int there.

Jul 22 '05 #3
John Harrison wrote:
"Mike" <no****@nospam.com> wrote in message
news:GY***************@newsfe1-win.ntli.net...
Got a wierd one here.

I have a class function with 4 parameters, defined like

myclass::myfunc(size_t p1, size_t p2, size_t p3 = 1, bool p4 = TRUE)

If I then call that function like

myptr->myfunc(1,2,3,FALSE);

I get a link error..

myprog.obj : error LNK2001: unresolved external symbol "public: void
__thiscall myclass::myfunc(unsigned int,unsigned int,unsigned int,int)"
(?myfunc@myclass@@QAEXIIIH@Z)
Debug/myprog.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

rf_modem.exe - 2 error(s), 0 warning(s)

However, if I change the definition and implementation, changing the
bool to another unsigned int, it all builds without any problems.

Anyone got any comments on why this should be ? It's MS Visual C++ V6

Are you sure you are not mixing up bool and BOOL? You are definitely mixing
up false and FALSE, true and TRUE (it should be false and true).

Look out for #defines like this '#define bool int' or '#define bool BOOL'.
It's clear from your error message that your compiler is interpreting bool
as int. That could be because somewhere in your code you have #define bool
...

john


Ha! you were right there was an include file that redefined true, false
and bool.

Thanks.

Jul 22 '05 #4

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

Similar topics

0
by: KS | last post by:
I am getting linker error for a code that was tested and running. I opened the project in VS.NET 2003 and now i get these errors - I am sure it is some options issue. Can anyone please help? ...
1
by: endo55 | last post by:
Hi I've got the following errors when trying to compile a program cvision error LNK2001: unresolved external symbol _IID_IGraphBuilde cvision error LNK2001: unresolved external symbo...
4
by: Saran | last post by:
Hi All, I'm getting the following linker error when I try to build a library. nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv nafxcw.lib(appcore.obj) : error...
4
by: Joel Whitehouse | last post by:
Hello All, I have a Visual C++ 2003 dll solution in a directory called "Antenna Test Range Control", and when I comile it, I get the error LNK1104: cannot open file "antenna.obj". When I remove...
3
by: ac2806 | last post by:
Hi I want to use the static MFC within a dll, but I get the following errors when linking: nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv nafxcwd.lib(appcore.obj)...
3
by: Chucker | last post by:
Hi Folks, I got a Wrapper Dll around a native C++ static library. In .NET 1.1 this worked fine. When moving to .NET 2.0 I get a couple of unresolved externals / linker errors: Error 16 error...
1
by: developer | last post by:
Hi All I have made a .NET project. the files included are borland c++ files that i am migrate to VC++ .NET I am using Microsoft Visual C++ .NET 2003. the compilation goes through properly,...
1
by: iiitsunny | last post by:
i have ported one project which was working in VC6 to VC7. Now the project is working fine in VC7 also. I have made some additions in VC7 environment only. But the problem is that the project is not...
2
by: NvrBst | last post by:
I have C99 code (which I changed extensions to .cpp to compile as C+ +98). Which is does fine. I create a Static Library Project (.lib) and Build, and it builds the .obj files (9 of them) and...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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...

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.