Hello World!!!
I have the following code
First File (.hpp)
//----------------
namespace A
{
typedef unsigned short ushort
class myClass //definition
}
Second File (.cpp)
//---------------
namespace A
{
class myClass //implementation
}
Third File (.cpp)
//---------------
namespace A
{
string itos(ushort i)
{
//some code
}
}
the problem is that in the third file the ushort isn't recognized
why??? 5 6955
On Jan 18, 2:38 pm, "br<dF^n" <vasand...@gmai l.comwrote:
Hello World!!!
I have the following code
First File (.hpp)
//----------------
namespace A
{
typedef unsigned short ushort
class myClass //definition
}
Second File (.cpp)
//---------------
namespace A
{
class myClass //implementation
}
Third File (.cpp)
//---------------
namespace A
{
string itos(ushort i)
{
//some code
}
}
the problem is that in the third file the ushort isn't recognized
why???
#include?
On 19 Éáí, 00:44, vasyu...@gmail. com wrote:
On Jan 18, 2:38 pm, "br<dF^n" <vasand...@gmai l.comwrote:
Hello World!!!
I have the following code
First File (.hpp)
//----------------
namespace A
{
typedef unsigned short ushort
class myClass //definition
}
Second File (.cpp)
//---------------
namespace A
{
class myClass //implementation
}
Third File (.cpp)
//---------------
namespace A
{
string itos(ushort i)
{
//some code
}
}
the problem is that in the third file the ushort isn't recognized
why???
#include?
1) First File "seat.h"
iostream, string
2) Second File (seat.cpp)
"seat.h"
3) Third File (itos.cpp)
iostream, string, sstream
On 2008-01-18 23:38, br<dF^n wrote:
Hello World!!!
I have the following code
First File (.hpp)
//----------------
namespace A
{
typedef unsigned short ushort
class myClass //definition
}
Second File (.cpp)
//---------------
namespace A
{
class myClass //implementation
}
Third File (.cpp)
//---------------
namespace A
{
string itos(ushort i)
{
//some code
}
}
the problem is that in the third file the ushort isn't recognized
why???
Since you have not shown us any of the actual code we can only guess,
but I think it is because you have not included the first file in the
third (it should be included in the second too, if you have not already
done that).
--
Erik Wikström
br<dF^n wrote:
On 19 Éáí, 00:44, vasyu...@gmail. com wrote:
>#include?
1) First File "seat.h"
iostream, string
2) Second File (seat.cpp)
"seat.h"
3) Third File (itos.cpp)
iostream, string, sstream
So there you are, you have answered your own question, no include of
"seat.h".
--
Ian Collins.
On 19 Ιαν, 00:52, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2008-01-18 23:38, br<dF^n wrote:
Hello World!!!
I have the following code
First File (.hpp)
//----------------
namespace A
{
typedef unsigned short ushort
class myClass //definition
}
Second File (.cpp)
//---------------
namespace A
{
class myClass //implementation
}
Third File (.cpp)
//---------------
namespace A
{
string itos(ushort i)
{
//some code
}
}
the problem is that in the third file the ushort isn't recognized
why???
Since you have not shown us any of the actual code we can only guess,
but I think it is because you have not included the first file in the
third (it should be included in the second too, if you have not already
done that).
--
Erik Wikström
we are right thank you! i'm a little confused with namespaces and
headers in C++ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steven T. Hatton |
last post by:
In the following code, the only way I can figure out to pass an array of
const is by setting the template argument to const in the instanciation
expression. It would be (or seem to me) better if I could set that
qualifier in the function call. Can that be done?
#include <iostream>
using std::ostream;
using std::cout;
|
by: trying_to_learn |
last post by:
im in the primary stages of learning C++. The book im learning from says
Dont use using namespace.. directive in header file
However im trying to make the following header file.I need to include
<string> header file and also will have to say using namespace std to
make the string class visible.
qn)how do i resolve the requirement of *not* using the "using" directive
in the header file and at the same time declare my structure in the...
|
by: lallous |
last post by:
Hello
I noticed that when I use #define inside a namespace then this #define only
works when prefixed with the namespace name.
Is this behaviour standard or just compiler specific?
I use VC7.
namespace test
|
by: Patrick Guio |
last post by:
Dear all,
I try to compile the following code in two ways:
* using one compilation unit:
g++ main.cpp base.cpp -o main
* creating a library for the class factory.
g++ -c -o base.o base.cpp
ar rv libfactory.a base.o
|
by: Enos Meroka |
last post by:
Hallo,
I am a student doing my project in the university.. I have been trying
to compile the program using HP -UX aCC compiler, however I keep on
getting the following errors.
=================================================================
Error 19: "CORBAManagerMessages.h", line 4 # Unexpected 'std'.
using std::string;
^^^
| |
by: yee young han |
last post by:
I need a fast data structure and algorithm like below condition.
(1) this data structure contain only 10,000 data entry.
(2) data structure's one entry is like below
typedef struct _DataEntry_
{
char szInput;
char szOutput;
int iSum;
|
by: SpOiLeR |
last post by:
Why doesn't following code compile? Problem line is commented in code.
---------------------- Cut here-------------------------------
#include <iostream>
#include <list>
#include <string>
using namespace std;
|
by: Patrick Guio |
last post by:
Dear all,
I have some problem with insertion operator together with namespace.
I have a header file foo.h containing declaration of classes, typedefs and
insertion operators for the typedefs in a named namespace
namespace foo
{
class Foo
|
by: bogus1one |
last post by:
Hi All
Given the following:
// NamespaceTemplate.cpp : Defines the entry point for the console
application.
//
#include "stdafx.h"
|
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,...
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |