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

Struct initialization error: multiple definition on TuBL

Can anyone tell me why this piece of program:


Expand|Select|Wrap|Line Numbers
  1. typedef struct
  2. {
  3.     int s0;
  4.     int s1;
  5. }MyBL;
  6.  
  7.  
  8. MyBL TuBL = {22, 23};
  9.  
  10.  
gives a compiler/linker error "multiple definition on TuBL"
Oct 9 '10 #1
1 2328
donbock
2,426 Expert 2GB
Does this snippet of code occur in a header file? If so, then TuBL is defined each time the header file is included.

Is it possible that some other global symbol called TuBL exists somewhere else in your code? The other instance of TuBL might be a different type and be for a completely different purpose. It might even be a function name.

You could sidestep global namespace conflicts if TuBL were defined static; that is, as a local variable.
Oct 9 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Yuri | last post by:
Hello everyone. I'm trying to use CopyMemory API in VB.NET. I have a module with struct defined like this: <StructLayout(LayoutKind.Sequential)> _ Public Structure tSortKey <VBFixedString(6),...
3
by: Chandu | last post by:
In using the following struct format I get the size as 593. The same C struct is 590 if packed on byte boundary and 596 when using pragma pack(4). I am using pack(4) and added 3 spares at the end...
4
by: quek | last post by:
Im having a problem passing a struct ptr. Maybe someone could help me. Heres what Visual C gives me as error: error C2664: 'adpcm_coder_u' : cannot convert parameter 4 from 'struct main::$S1 *'...
28
by: Tamir Khason | last post by:
Follwing the struct: public struct TpSomeMsgRep { public uint SomeId;
0
by: ccfq | last post by:
I have a problem with GCC and C. (under Windows XP, CPU 32-bit Athlon XP, gcc version 3.4.5, mingw special) Is there some simple way to return the size of a large file (2GB+) without opening it?...
3
by: angshuman.agarwal | last post by:
Structure in C DLL ---------------------------- typedef struct IrData { unsigned short uiFormat; unsigned short uiLength; unsigned char* pchData; } tagIrData; Function in C DLL
1
by: PLS | last post by:
I'm trying to write the definition of a struct that must exactly match the binary layout of a struct created by a native c++ program. The C++ struct contains several wchar_t and char fields...
1
by: prads | last post by:
hello, i have a struct and have declared it as shown below. If i print its value in the main() fn it prints it correctly.However if i declare the struct again in the main() and try to print its...
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?
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.