473,765 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

variables & method naming conflicts

Hi Gurus,
I got a problem, I am trying to port a win32 prog to Linux. It was all
one big program.cpp and I have to split the functions into separate
init_pxi6052e.c pp,func1.cpp and func2.cpp in order to compile them
separately and debug them. In both cpp file I have to include a common
header file lets call it here as "datatype.h " which is included in both
"init_pxi6052e. cpp" and "test_init_boar ds.cpp". Both these object
compiles ok. SEe here
%g++ -c test_init_board s.cpp
%g++ -c init_pxi6052e.c pp
However it screws up where I try to link them together to an
executable.

%g++ -o test_init_board s test_init_board s.o init_pxi6052e.o
callback_everyn .o -lnidaqmx
init_pxi6052e.o (.bss+0x20): multiple definition of `InputDataBuffe r'
test_init_board s.o(.bss+0x20): first defined here
init_pxi6052e.o (.bss+0x24): multiple definition of `OutputDataBuff er'
test_init_board s.o(.bss+0x24): first defined here
init_pxi6052e.o (.bss+0x40): multiple definition of `msg'
test_init_board s.o(.bss+0x40): first defined here
.... [many lines more here]

I am mixing some C header files in the "datatype.h " files. What is the
best ways to handle this? Please help!

Feb 27 '06 #1
2 1767
Joseph wrote:
Hi Gurus,
I got a problem, I am trying to port a win32 prog to Linux. It was all
one big program.cpp and I have to split the functions into separate
init_pxi6052e.c pp,func1.cpp and func2.cpp in order to compile them
separately and debug them. In both cpp file I have to include a common
header file lets call it here as "datatype.h " which is included in both
"init_pxi6052e. cpp" and "test_init_boar ds.cpp". Both these object
compiles ok. SEe here
%g++ -c test_init_board s.cpp
%g++ -c init_pxi6052e.c pp
However it screws up where I try to link them together to an
executable.

%g++ -o test_init_board s test_init_board s.o init_pxi6052e.o
callback_everyn .o -lnidaqmx
init_pxi6052e.o (.bss+0x20): multiple definition of `InputDataBuffe r'
test_init_board s.o(.bss+0x20): first defined here
init_pxi6052e.o (.bss+0x24): multiple definition of `OutputDataBuff er'
test_init_board s.o(.bss+0x24): first defined here
init_pxi6052e.o (.bss+0x40): multiple definition of `msg'
test_init_board s.o(.bss+0x40): first defined here
... [many lines more here]

I am mixing some C header files in the "datatype.h " files. What is the
best ways to handle this? Please help!


What are InputDataBuffer , OutputDataBuffe r and msg? Are they types? Global
variables? Where are they defined? In the cpp files or in the header? Where
is their declaration?

Feb 27 '06 #2
JE

Joseph wrote:
<snip>
I have to include a common
header file lets call it here as "datatype.h " which is included in both
"init_pxi6052e. cpp" and "test_init_boar ds.cpp". <snip> multiple definition of

<snip whatever>

Maybe you've got globals that violate the "One Definition Rule" in
header(s)? Make sure you've got extern whatever in the header (_not_
initialized, because that would be a definition) for your declaration,
and _one_ definition in one of your .cpp files...

JE

Feb 27 '06 #3

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

Similar topics

0
4495
by: JShurmatz | last post by:
If anyone can shed some light on this problem I would greatly appreciate it. I am unsuccessfully trying to use a database connnection retrieved from a pool configured using Java System Web Server 6.1 with the SQL Server 2000 JDBC Driver. The background: 1. I have downloaded the SQL Server 2000 JDBC Driver and installed it on the web server.
3
2376
by: John Salerno | last post by:
Does Microsoft have any naming guidelines for variables? I've been reading their guidelines for just about every other type (methods, parameters, properties, etc.) but nothing about variables. Are variables treated the same as parameters (i.e., camel case)? I notice that Hungarian notation is being done away with. Also, is it good practice to use an underscore to begin the name of a field? I've seen that, and it seems like a good idea,...
3
1152
by: Adam Knight | last post by:
Hi all, Can I have a class that contains a IsDirector Method & IsDirector property. The method populates the property. I have tried the code below..but get a 'definition for IsDirector' already exists. Cheers, Adam
2
1811
by: John Salerno | last post by:
After reading the PEP, I'm still not quite sure if there is a recommended (or widely preferred) method of naming variables. Here are the relevant bits: > Global Variable Names > > (Let's hope that these variables are meant for use inside one module > only.) The conventions are about the same as those for functions. > > Modules that are designed for use via "from M import *" should use the
2
3990
by: Rob Long | last post by:
Hi there Is there any way to access private variables directly from within a priviliged function? I have a situation where the priviliged function's execution context contains variables of the same name as the parent context, but I want direct access to the parent context's variable. E.g. I would like to be able to do this... function Point()
114
7879
by: Jonathan Wood | last post by:
I was just wondering what naming convention most of you use for class variables. Underscore, "m_" prefix, camel case, capitalized, etc? Has one style emerged as the most popular? Thanks for any comments. --
0
318
by: Zytan | last post by:
http://msdn2.microsoft.com/en-us/library/system.exception.data(VS.80).aspx says: "Avoid key conflicts by adopting a naming convention to generate unique keys for key/value pairs. ... two applications, named Products and Suppliers, each has a method named Sales. The Sales method in the Products application provides the SKU of a product. The Sales method in the Suppliers application provides the SID of a supplier. The naming convention...
20
4042
by: tshad | last post by:
Using VS 2003, I am trying to take a class that I created to create new variable types to handle nulls and track changes to standard variable types. This is for use with database variables. This tells me if a variable has changed, give me the original and current value, and whether the current value and original value is/was null or not. This one works fine but is recreating the same methods over and over for each variable type. ...
1
29378
weaknessforcats
by: weaknessforcats | last post by:
C++: The Case Against Global Variables Summary This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have called it polluting the global namespace. This article explores what happens when the global namespace becomes polluted and how to avoid this condition. The opinions expressed in this article are those of the author alone although many have...
0
9568
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
9399
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9957
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
8832
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
7379
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
6649
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
5276
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...
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
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.