I am trying to compile my code from several small files, as it was getting unweildly in a large file.
I have simplified my problem somewhat, and if I could solve this example the rest may flow. (or I'll get into deeper water!) This is Visual c++ 2005 express edition.
file 1: aaa.hpp
Expand|Select|Wrap|Line Numbers
- #ifndef AAA_H
- #define AAA_H
- #pragma once
- class aaa {
- public:
- aaa(char *str);
- void setFile(char *str );
- int record_count() ;
- private:
- char filename[256]; // filename of the data file for the data
- int numrecords;
- } ;
- #endif
Expand|Select|Wrap|Line Numbers
- #include "aaa.hpp"
- class aaa {
- public:
- aaa(char *str) {
- // Constructor
- std::cout << "\n\n----------\nData for:" << filename << "\n" ;
- } ;
- void setFile(char *str) {
- strcpy_s( filename, str ); // store main directory
- } ;
- int record_count() {
- return numrecords ;
- } ;
- private:
- char filename[256]; // filename of the data file for the data
- int numrecords;
- } ;
Expand|Select|Wrap|Line Numbers
- Compiling...
- class aaa.cpp
- .\class aaa.cpp(17) : error C2011: 'aaa' : 'class' type redefinition
- c:\documents and settings\fred\my documents\visual studio 2005\projects\testing classes\testing classes\aaa.hpp(5) : see declaration of 'aaa'
So far I have written my application nicely in a big file, and am referring to my books here at home to check on the content of the header file in case I have mucked up my definitions, but there is not a lot of info I can find to narrow it down.
Any assistance greatfully accepted,
Thanks,
Treegum