Jump to content
  • Advertisement
Sign in to follow this  
jimbogd

help with error: JRect' was not declared in this scope

This topic is 4176 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

Hi I've created a template class called JRect<T> which sits in JRect.h/JRect.cpp. When including it in my main script I'm doing this: #include <JRect.h> // prototype void SetCamera(JRect<unsigned int> rect); I'm getting the error: `JRect' was not declared in this scope, pointing me to the line containing the function prototype. I'm sure its included propery as if I move JRect.h I get loads of other errors (can't find it). I'm using gcc/mingw as the compiler (on windows), and my makefile is as follows: objects = jtest.o JRect.o flags = -DWIN32 -D_GNU_SOURCE=1 -Dmain=SDL_main libs = -lmingw32 -lSDLmain -lSDL -lSDL_image -lSDL_ttf -lopengl32 -mwindows engine : $(objects) g++ -o jtest.exe $(flags) $(libfolder) $(includefolder) $(objects) $(libs) jtest.o : jtest.cpp g++ $(flags) $(includefolder) -c -o jtest.o jtest.cpp JRect.o : JRect.cpp g++ $(flags) $(includefolder) -c -o JRect.o JRect.cpp Any help appreciated! thanks jimbogd

Share this post


Link to post
Share on other sites
Advertisement
Hi,

THanks for the advice. I changed the #include to "JRect.h" but I'm still getting the same compiler error. :(

jimbogd

Share this post


Link to post
Share on other sites
Try

#include "JRect.hpp"

Although "JRect.h" should be working, a few times I ran into that problem and I resaved the file as JRect.hpp and then used "JRect.hpp"

Share this post


Link to post
Share on other sites
I figured it out... I had a namespace of "jimbo" in my JRect class, but in my main script I wasn't doing:

using namespace jimbo;

cheers

jimbogd

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!