Sign in to follow this  
supagu

gcc template compile problem

Recommended Posts

i have another gcc problem which is rather bizarre. statemachine.h: template <class T> class TStateMachine { // code }; gamestate.h: class GameState { //code }; game.h: #include "GameState.h" #include StateMachine.h" class TestAnim : public TStateMachine<GameState> { //code }; i get the following compile error using gcc: /home/bronson/workspace/Project/AirBlimbs/Source/Game/Game.h:21: error: expected template-name before ‘<’ token /home/bronson/workspace/Project/AirBlimbs/Source/Game/Game.h:21: error: expected `{' before ‘<’ token /home/bronson/workspace/Project/AirBlimbs/Source/Game/Game.h:21: error: expected unqualified-id before ‘<’ token /home/bronson/workspace/Project/AirBlimbs/Source/Game/Game.h:30: error: expected template-name before ‘<’ token /home/bronson/workspace/Project/AirBlimbs/Source/Game/Game.h:30: error: expected `{' before ‘<’ token /home/bronson/workspace/Project/AirBlimbs/Source/Game/Game.h:30: error: expected unqualified-id before ‘<’ token if i cut and paste the code in to game.h it compiles fine. ideas? btw this code works fine in visual studio

Share this post


Link to post
Share on other sites
The error message is saying than g++ is expecting a template name but you aren't providing one. It's impossible to tell you more without seeing the actual source code. Aren't you forgetting a namespace? Have you checked for possible typos that you'd have fixed without noticing while typing here? Posting the actual code is important.

Share this post


Link to post
Share on other sites
hrmm Initially it was called StateMachine i changed it to TStateMachine and it still didnt work, so i changed it back and now its working

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this