473,779 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MSVC++ 6.0 Linking problem (possible OT)

TestClass.obj : error LNK2005: "int volatile bIsProcessing"
(?bIsProcessing @@3HC) already defined in OtherClass.obj

Creating library Release/TestDLL.lib and object Release/TestDLL.exp
Release/TestDLL.dll : fatal error LNK1169: one or more multiply defined
symbols found
In TestClass header file I have:
volatile BOOL bIsProcessing;

In OtherClass I have:
volatile BOOL * pbProcessing;

I cannot link, and I am confused as what is wrong? I can't see any
difference between this situation and one in a different project which
is linking ok

Aug 31 '06 #1
3 2174
"hamishd" <Ha*********@gm ail.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
TestClass.obj : error LNK2005: "int volatile bIsProcessing"
(?bIsProcessing @@3HC) already defined in OtherClass.obj

Creating library Release/TestDLL.lib and object Release/TestDLL.exp
Release/TestDLL.dll : fatal error LNK1169: one or more multiply defined
symbols found
In TestClass header file I have:
volatile BOOL bIsProcessing;
Is this maybe a global defined in the header and included in both?
--
Jeff Partch [VC++ MVP]
Aug 31 '06 #2
hamishd wrote:
TestClass.obj : error LNK2005: "int volatile bIsProcessing"
(?bIsProcessing @@3HC) already defined in OtherClass.obj

Creating library Release/TestDLL.lib and object Release/TestDLL.exp
Release/TestDLL.dll : fatal error LNK1169: one or more multiply
defined symbols found
In TestClass header file I have:
volatile BOOL bIsProcessing;
Never put definitions in the header, unless they are definitions of
functions declared 'inline'. Or definitions of classes. Or of class
templates. Or of function templates. Anyway, do not define *objects*
in headers.

What you probably want is

extern volatile BOOL bIsProcessing; // declaration

in the header and then

volatile BOOL bIsProcessing = false; // definition

in *one* of the C++ files.
In OtherClass I have:
volatile BOOL * pbProcessing;

I cannot link, and I am confused as what is wrong?
The linker already told you: multiple definition of an object.
I can't see any
difference between this situation and one in a different project which
is linking ok
What can I say? Look more carefully. There must be a difference.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 31 '06 #3
Never put definitions in the header, unless they are definitions of
functions declared 'inline'. Or definitions of classes. Or of class
templates. Or of function templates. Anyway, do not define *objects*
in headers.

What you probably want is

extern volatile BOOL bIsProcessing; // declaration

in the header and then

volatile BOOL bIsProcessing = false; // definition

in *one* of the C++ files.
Thanks. Got it.

Aug 31 '06 #4

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

Similar topics

2
4381
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two files containing some templates: adjacency_list.hpp and mem_fn.hpp can not compile. Does anyone have any solutions?
3
6758
by: Rolf Hemmerling | last post by:
Hello ! Beginner's question: Howto access .RC/.RES Ressource files with portable C++ code ( BCC,MSVC,GNU-C++, OpenWatcom) ? I just wanna access "local language strings", so that I may replace the ..RC file to compile a version of my software for a different language.
8
1918
by: Chris Stankevitz | last post by:
I can't tell you how frusterated I and my coworkers are with "MSVC 7.1 .net 2003" (what am I supposed to call this thing anyway?). Compiling and linking take twice as long with "MSVC 7.1 .net 2003" than with MSVC 6. My coworkers are angry at "MSVC .net 7.1 2003" and they're angry at me for pushing it (due to better C++ compliance). The problem is so pronounced, I'm shocked that this message board isn't full of people complaining. My...
6
3452
by: Uli | last post by:
Hello, I'm trying to use a DLL (by static linking) which was compiled with Borland C++Builder (BCB) in Visual C++ (Visual-Studio 2003). All functions are declared with the directive 'extern "C"' so that a cross-compiler-usage must be possible. I created an import library (.lib) for MSVC by using the LIB function and using a .DEF file (as described in KB131313 -
6
2581
by: Chris Stankevitz | last post by:
At link time, MSVC determines some of my libraries are unused and doesn't link them into my exe. This undesirable feature causes problems when I employ the factory pattern. With the factory pattern, the app decides at run time which code to use. Is there a link option to turn of this feature? MSVC 7.1 .net 2003 69462-270-0000007-18536 Thanks,
1
3491
by: JSeligstein | last post by:
Hey all. I am trying to link my application with a threaded image library which tries to link to (at least) libmmt.lib and libirc.lib. I am using MSVC++ 2005 Express Edition. Can anyone help me link these? I don't even appear to have these files on the computer. Surely there is a way.
3
33113
by: salunkerahul | last post by:
Hello All, I have some static libraries generated on MSVC 2005 express edition and I have to use them along with static libraries created with MSVC 2003 and create an application on MSVC2003. example.lib - generated on MSVC2005 All other libs - generated on MSVC2003 I have attached the compiler options as well as the error log along. Any tips/suggestions will be of great help. Thanks in Advance
2
4143
by: BruceWho | last post by:
I downloaded boost1.35.0 and built it with following command: bjam --toolset=msvc-7.1 --variant=release --threading=multi -- link=shared --with-system stage and it failed to compile, error message is: E:\software\development\boost_1_35_0\boost_1_35_0>bjam -- toolset=msvc-7.1 --variant=release --threading=multi --link=shared --
1
1684
by: Jim Langston | last post by:
I'm trying to compile some source code to interface LUA into C++. When I compile in MSVC++ Express 2008, however, I get the error (among others): ....\luastate.h(129) : error C2027: use of undefined type 'cpplua::LuaFunction' ....\luastate.h(63) : see declaration of 'cpplua::LuaFunction' So I'm trying to track this down. I see that there is a function trying to return LuaFunction Like this:
0
9636
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10306
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10138
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10074
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8961
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.