Hi,
I am learning C++ from the following C++ website, which has some very
good small examples. For the second Fraction example, which has five
files:
Main.cpp
Fraction.cpp
Fraction.h
msoftcon.cpp
msoftcon.h
,,,,,
A Fraction class that has the ability to add, subtract, multiply,
divide and show various statistics of the fraction. http://www.cplusplus.com/src/
,,,,,,,,,,,,,
When I compile them, MSVC 6++ compiler says:
error C2653: 'Fraction' : is not a class or namespace name
if I put Fraction.h with the .cpp under Source Files category.
If I put Fraction.h under Header Files category, the compiler cannod
find the .h file. I have also tried Settings in the Project menu
without success. I am new to MSVC and C++, could you help me the
settings? Thank you very much. 17 3109
On Dec 25, 10:15 pm, fl <rxjw...@gmail. comwrote:
Hi,
I am learning C++ from the following C++ website, which has some very
good small examples. For the second Fraction example, which has five
files:
Main.cpp
Fraction.cpp
Fraction.h
msoftcon.cpp
msoftcon.h
,,,,,
A Fraction class that has the ability to add, subtract, multiply,
divide and show various statistics of the fraction.
http://www.cplusplus.com/src/
,,,,,,,,,,,,,
When I compile them, MSVC 6++ compiler says:
error C2653: 'Fraction' : is not a class or namespace name
if I put Fraction.h with the .cpp under Source Files category.
If I put Fraction.h under Header Files category, the compiler cannod
find the .h file. I have also tried Settings in the Project menu
without success. I am new to MSVC and C++, could you help me the
settings? Thank you very much.
Did you #include "Fraction.h " in Main.cpp and Fraction.cpp?
On 25 déc, 23:12, johanatan <johana...@gmai l.comwrote:
On Dec 25, 10:15 pm, fl <rxjw...@gmail. comwrote:
Hi,
I am learning C++ from the following C++ website, which has some very
good small examples. For the second Fraction example, which has five
files:
Main.cpp
Fraction.cpp
Fraction.h
msoftcon.cpp
msoftcon.h
,,,,,
A Fraction class that has the ability to add, subtract, multiply,
divide and show various statistics of the fraction.
http://www.cplusplus.com/src/
,,,,,,,,,,,,,
When I compile them, MSVC 6++ compiler says:
error C2653: 'Fraction' : is not a class or namespace name
if I put Fraction.h with the .cpp under Source Files category.
If I put Fraction.h under Header Files category, the compiler cannod
find the .h file. I have also tried Settings in the Project menu
without success. I am new to MSVC and C++, could you help me the
settings? Thank you very much.
Did you #include "Fraction.h " in Main.cpp and Fraction.cpp?- Masquer le texte des messages précédents -
- Afficher le texte des messages précédents -
In Main.cpp, Fraction.h is included.
At the end of Fraction.h, there is:
...........
#include "Fraction.c pp"
#endif
...........
Fraction.cpp seems to be part of declaration of class Fraction
function. I don't know how to solve this. Thanks.
fl wrote:
Hi,
I am learning C++ from the following C++ website, which has some very
good small examples. For the second Fraction example, which has five
files:
Main.cpp
Fraction.cpp
Fraction.h
msoftcon.cpp
msoftcon.h
,,,,,
A Fraction class that has the ability to add, subtract, multiply,
divide and show various statistics of the fraction.
http://www.cplusplus.com/src/
,,,,,,,,,,,,,
When I compile them, MSVC 6++ compiler says:
error C2653: 'Fraction' : is not a class or namespace name
if I put Fraction.h with the .cpp under Source Files category.
If I put Fraction.h under Header Files category, the compiler cannod
find the .h file. I have also tried Settings in the Project menu
without success. I am new to MSVC and C++, could you help me the
settings? Thank you very much.
You have to include the header in the source file. Your book should
explain this.
Brian
On 25 déc, 23:23, "Default User" <defaultuse...@ yahoo.comwrote:
fl wrote:
Hi,
I am learning C++ from the following C++ website, which has some very
good small examples. For the second Fraction example, which has five
files:
Main.cpp
Fraction.cpp
Fraction.h
msoftcon.cpp
msoftcon.h
,,,,,
A Fraction class that has the ability to add, subtract, multiply,
divide and show various statistics of the fraction.
http://www.cplusplus.com/src/
,,,,,,,,,,,,,
When I compile them, MSVC 6++ compiler says:
error C2653: 'Fraction' : is not a class or namespace name
if I put Fraction.h with the .cpp under Source Files category.
If I put Fraction.h under Header Files category, the compiler cannod
find the .h file. I have also tried Settings in the Project menu
without success. I am new to MSVC and C++, could you help me the
settings? Thank you very much.
You have to include the header in the source file. Your book should
explain this.
Brian- Masquer le texte des messages précédents -
- Afficher le texte des messages précédents -
The Fraction.h is included in the main.cpp, see below.
// Allow the integer type to be changed on the fly
#define BIGGEST_INT int
#include <iostream.h// Include C++ input/output functions
#include <stdio.h> // Include C input/output functions
#include <conio.h // Include for pausing the program
#include <stdlib.h // Include C Library functions
#include "Fraction.h " // Includes the Fraction Header File
#include "msoftcon.h " // Allows more functionality to MVC++ console
int main() {
Fraction a;
Fraction b;
Fraction c;
-----
Thanks.
The example is broken, I am afraid you may have to spend some time
reading the code and debugging. It will be a good learning
experience :)
fl wrote:
Hi,
I am learning C++ from the following C++ website, which has some very
good small examples. For the second Fraction example, which has five
files:
Main.cpp
Fraction.cpp
Fraction.h
msoftcon.cpp
msoftcon.h
,,,,,
A Fraction class that has the ability to add, subtract, multiply,
divide and show various statistics of the fraction.
http://www.cplusplus.com/src/
,,,,,,,,,,,,,
When I compile them, MSVC 6++ compiler says:
error C2653: 'Fraction' : is not a class or namespace name
if I put Fraction.h with the .cpp under Source Files category.
If I put Fraction.h under Header Files category, the compiler cannod
find the .h file. I have also tried Settings in the Project menu
without success. I am new to MSVC and C++, could you help me the
settings? Thank you very much.
On 2007-12-26 04:15, fl wrote:
Hi,
I am learning C++ from the following C++ website, which has some very
good small examples. For the second Fraction example, which has five
files:
A few tips if you want to learn C++:
1. While there are some websites out there which I would classify as
"not bad" there are none that I would consider "good", and they tend to
be very incomplete (not discussing important topics or only parts of
them). There are a number of good books out there, and if you search the
archives you can find a few that gets recommended often.
2. There are good compilers and there are bad compilers. MSVC++ 6 is one
of the worst, it is simply too old (almost 10 years now) and does not
support many features in C++. If you want to learn you have to get a
newer one, there are a number of gcc bases you can download, and
Microsoft's Visual C++ 2008 Express can also be downloaded for free.
--
Erik Wikström
fl wrote:
On 25 déc, 23:23, "Default User" <defaultuse...@ yahoo.comwrote:
You have to include the header in the source file. Your book should
explain this.
The Fraction.h is included in the main.cpp, see below.
Post a complete, minimal program that demonstrates the problem. That
means the header files as well as the source. See the newsgroup FAQ
under "how to post".
Brian
On 26 déc, 06:42, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2007-12-26 04:15, fl wrote:
Hi,
I am learning C++ from the following C++ website, which has some very
good small examples. For the second Fraction example, which has five
files:
A few tips if you want to learn C++:
1. While there are some websites out there which I would classify as
"not bad" there are none that I would consider "good", and they tend to
be very incomplete (not discussing important topics or only parts of
them). There are a number of good books out there, and if you search the
archives you can find a few that gets recommended often.
2. There are good compilers and there are bad compilers. MSVC++ 6 is one
of the worst, it is simply too old (almost 10 years now) and does not
support many features in C++. If you want to learn you have to get a
newer one, there are a number of gcc bases you can download, and
Microsoft's Visual C++ 2008 Express can also be downloaded for free.
--
Erik Wikström
Hi,
Thank all of you very much. In fact, I am reading the cpp primer of
lippman now. And I have one MS .net V7.1 enen though it is not a
English version. I have downloaded the source code of that book. But I
don't know the best way to use it, i.e. How to compile it as in the
readme.txt file? It says:
--------------------
To use make on a Windows operating system you invoke the command
name "nmake":
## Windows machines
nmake # compiles all the programs
nmake clean # removes all the object files and stackdumps
nmake clobber # removes executable, object and stackdump
files
--------------------
My computer doesn't understand the nmake command. Could you tell me
something about that? Thanks again.
On Dec 25, 11:23 pm, fl <rxjw...@gmail. comwrote:
On 25 déc, 23:12, johanatan <johana...@gmai l.comwrote:
On Dec 25, 10:15 pm, fl <rxjw...@gmail. comwrote:
Hi,
I am learning C++ from the following C++ website, which has some very
good small examples. For the second Fraction example, which has five
files:
Main.cpp
Fraction.cpp
Fraction.h
msoftcon.cpp
msoftcon.h
,,,,,
A Fraction class that has the ability to add, subtract, multiply,
divide and show various statistics of the fraction.
>http://www.cplusplus.com/src/
,,,,,,,,,,,,,
When I compile them, MSVC 6++ compiler says:
error C2653: 'Fraction' : is not a class or namespace name
if I put Fraction.h with the .cpp under Source Files category.
If I put Fraction.h under Header Files category, the compiler cannod
find the .h file. I have also tried Settings in the Project menu
without success. I am new to MSVC and C++, could you help me the
settings? Thank you very much.
Did you #include "Fraction.h " in Main.cpp and Fraction.cpp?- Masquer le texte des messages précédents -
- Afficher le texte des messages précédents -
In Main.cpp, Fraction.h is included.
At the end of Fraction.h, there is:
...........
#include "Fraction.c pp"
#endif
...........
Fraction.cpp seems to be part of declaration of class Fraction
function. I don't know how to solve this. Thanks.
No need to #include the cpp. VC++ will compile the cpp if it is in
your 'source files' section of Solution Explorer (i.e., has been added
to the project).
--Jonathan This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Eric Brunel |
last post by:
Hi all,
We're trying to communicate with Microsoft Visual C++ 6.0 via COM to make it
perform a few operations. Our main need is to set a breakpoint on a given line
in a given file. We ended up with the following script:
---------------------------------------------
import win32com.client
import time
|
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?
|
by: gok |
last post by:
I did purchased msvc.net 2003 last year and downloaded msvc.net 2002 (a must
for acad2004) from msdn. It was working fine forawhile and now after one week
vacation can not open studio:
“Application cannot startâ€
Did reinstall it from scratch: the same error message.
Could somebody help, please!
--
gok
|
by: user |
last post by:
I am trying to port a simple vector/matrix class library to mingw
(v3.4.2). I have used this library with no problem on MSVC++ v6 for a
number of years. My difficulty is that it does not compile under g++!
Two issues:
Firstly, if I define x to be a CColumnVector, y to be a CRowVector and M
to be a CMatrix (of the right size!) then:
M = x * y;
|
by: Babak |
last post by:
Hi Everyone,
I've written a standard C code for a simple finite element analysis
in MSVC++ . When I save the file as a cpp file, it compiles and runs
perfectly, but when I save it as a c file, there are lots of errors and
warnings in compiling stage. I am really confused about this problem
because I'm not even familiar with C++ and my code only includes simple
C functions. Can anybody please tell me what's my mistake? Is there any
other...
| |
by: Nindi |
last post by:
I cannot get the following code to compile under MSVC 2003 or 2005.
...........................................................................................
#include<stdio.h>
struct _MyStruct;
typedef struct _MyStruct MyStruct;
typedef void (*funcType)(MyStruct *);
|
by: reetugupta |
last post by:
i have created a dialog based application for calender.
coding is
void CcalenderDlg::DblClickCalendar1()
{
CString cSelectedDate;
char* cDay="";
char* cYear="";
itoa(m_calender.get_Day (),cDay,10);
|
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 --
|
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:
|
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...
|
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: 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: 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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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.
| |