473,396 Members | 2,002 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.

Visual Studio C++ System C - Error C2370 Redifinition; different storage class

Build error seems to pick up every constant I defined in top common_params.h with this error.
I have checked that it has not been multiply-included in modules.
Jun 14 '15 #1
1 2713
weaknessforcats
9,208 Expert Mod 8TB
Header files are not to contain constants. The reason is every time you include the header you get another variable of the same name.

Your common constants should be in a .cpp file which is part of your project.

You would have:

Expand|Select|Wrap|Line Numbers
  1. //common_params.cpp
  2.  
  3. char* str = "Message";
  4.  
  5. double pi = 3.14159;
  6.  
and the header would be:


Expand|Select|Wrap|Line Numbers
  1. //common_params.h
  2.  
  3. extern char* str;
  4. extern double pi; 
Jun 14 '15 #2

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

Similar topics

2
by: news.microsoft.com | last post by:
Hello, I created a ASP.NET VB project on my local IIS server. Now we set up a new server here in the office with a SSL on it and would like to move the project there so I can continue...
1
by: qwert | last post by:
Hello, when creating a user control with Visual Basic .NET (v2.0), I get the error: "Visual Studio requires that designers use the first class the the file." when I try it view it in Design...
7
by: Phill Emery | last post by:
hi can anyone please help me? Im new to visual studio 2003 and im trying to create a program in visual basic. The problem is i have put a menu bar onto the first form, and have created some...
1
by: tomkarachris | last post by:
i try instal visual studio and i get Error 1402.Could not open key: HKEY_LOCAL_MACHINE\Software\Classes\ITIR.CmdInt.4\CLSID. Verify that you have sufficient access to that key, or contact...
3
by: mauridepa | last post by:
I have Windows Vista with Visual Studio 2005 SP 1 i have a problem with debugger, when i start debug display this error: Unable to attach to application 'WebDev.WebServer.exe' (PID: 4832) using...
1
by: MarcW | last post by:
I have a fresh install of VS2008, and when I drag a data grid on and try and bind it (create a new connection) I get an error. If I connect to a database in the database window and then try and...
4
by: LilMeechc20 | last post by:
I am new to programming and my first assignment is to write the hello world code. However, I wrote the code, which is: #include <iostream> using namespace std; int main() { cout <<"Hello...
0
by: FiberOptix | last post by:
Hello, I've been trying to modify and then compile a portion of an open source C/C++ project with Visual Studio 2010. I'm very much a C++ beginner and this is a learning experience. Relevant...
2
by: doggylvr | last post by:
I am an old VB6 programmer who is just getting into VB.NET. I bought an old version of VB.NET (2003) just to make sure I would feel comfortable to make the transfer. I am working on Windows 8. My...
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: 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
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...
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...
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.