C++ does not name a type in Constructor definition -


i try compile code, pretty sure made mistake in headers or in compilation don't understand where. know basic problem, , read other topic, don't understand. , watch other code wrote , don't see difference...

g++ -c main.cpp -o out 

i don't understand error, try :

g++ -c readfastqfile.cpp 

the error

readfastqfile.cpp:8:1: error: ‘readfastq’ not name type  readfastq::readfastq(){ //constructor 

and files :

main.cpp

    #include <iostream>     #include <string>      #include "readfastqfile.hpp"  using namespace std;  int main(int argc, char *argv[]){     cout << "hello" <<endl;     //readfastq allreads;     return 0; } 

readfastqfile.hpp

#ifdef readfastqfile_hpp #define readfastqfile_hpp  #include <iostream> #include <string>  using namespace std;  class readfastq{     public:         readfastq(); //constructor      private:         string readname;         string sequence;         string score; }; #endif // readfastqfile_hpp 

readfastqfile.cpp

 #include <string>     #include <iostream> #include "readfastqfile.hpp"  using namespace std;  readfastq::readfastq(){ //constructor     readname = "bla";     cout << readname <<endl; } 

thanks

#ifdef readfastqfile_hpp should #ifndef readfastqfile_hpp. #ifdef causing contents of readfastqfile.hpp ignored, class definition isn't being compiled.

see include guards


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -