Jump to content
  • Advertisement
Sign in to follow this  
JustChris

Parse errors where syntax appears correct

This topic is 3857 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This file is giving me a lot of "parse error before x token" messages when I try to compile, and I've tried isolating a lot of things to get it working again. I just had the code exactly like this before and it won't compile anymore. Cleaning the compile target didn't work either.
// file objparse.h

#ifndef OBJPARSE_H
#define OBJPARSE_H

class OBJParser: public FileParser {

    private:
        int selected;
        const char* cs;
        struct VertexStruct {
            float x, y, z;
            float t, u;
            float nx, ny, nz;
        };
        struct IndexStruct {
            int tIndices;
        };

        std::vector<VertexStruct> Vertex;

    public:
        void readVertices(std::vector<VertexStruct>&);
};

#endif

The first error is on line 6, where the class OBJParser is being declared. It says that there's a parse error before '{'. Because of this it mentions OBJParser being undefined in other places, and that there's a forward declaration of OBJParser on this file. This is the only file where the class is declared.

Share this post


Link to post
Share on other sites
Advertisement
The error could be in the header file included directly before this one.

Look in the compiler output to see which CPP file is producing the error, then look at which header is included directly before this one.

Share this post


Link to post
Share on other sites
I think that was it, tidy. I thought including the header file for FileParser in the file with the main function would be enough. I moved it to the OBJParser file instead.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!