Page 1 of 1

Identifier not found when it is.... what?

Posted: Mon Sep 21, 2015 3:22 pm
by corey__cakes
I am making a level editor with C++ and SDL. In this program, I have function called CreateTexture() that returns a texture with the dimensions specified in what I pass through the parameters. This function is declared in a header SysFunc.h and defined in SysFunc.cpp (sorry if I use the wrong terminology there). So basically this:

Code: Select all

//SysFunc.h
#pragma once
#include <SDL.h>

//other functions and crap
SDL_Texture* CreateTexture(int Width, int Height, SDL_Renderer* renderer);

Code: Select all

//SysFunc.cpp
SDL_Texture* CreateTexture(int Width, int Height, SDL_Renderer* renderer) {
//create a texture n crap
return texture;
}
So all I have to do if I want to use this function is #include "SysFunc.h", right? Well it's not working. It was working fine up until a point where I added a bunch of calls to that function. I use Visual Studio and SDL2. If you need me to give more details. Just ask.
Thank you,

Now I'm going back to playing Runescape and being sad because my program don't work no mo.

Re: Identifier not found when it is.... what?

Posted: Mon Sep 21, 2015 3:44 pm
by dandymcgee
corey__cakes wrote:Well it's not working.
Well I can't help you [without more information about your actual problem]. Could you perhaps describe what exactly "not working" means?

Re: Identifier not found when it is.... what?

Posted: Mon Sep 21, 2015 4:04 pm
by corey__cakes
dandymcgee wrote:
corey__cakes wrote:Well it's not working.
Well I can't help you [without more information about your actual problem]. Could you perhaps describe what exactly "not working" means?
Sorry, I had to type this post twice because my internet was being stupid. So the second time was a little rushed. I keep getting the error "identifier not found."

Re: Identifier not found when it is.... what?

Posted: Mon Sep 21, 2015 5:02 pm
by dandymcgee
corey__cakes wrote:Sorry, I had to type this post twice because my internet was being stupid. So the second time was a little rushed. I keep getting the error "identifier not found."
Can you please post the exact, full error in [ code ] tags. I have no idea which identifier you're talking about.

Are you sure you're linking SDL properly?

Re: Identifier not found when it is.... what?

Posted: Tue Sep 22, 2015 12:32 pm
by corey__cakes
dandymcgee wrote:
corey__cakes wrote:Sorry, I had to type this post twice because my internet was being stupid. So the second time was a little rushed. I keep getting the error "identifier not found."
Can you please post the exact, full error in [ code ] tags. I have no idea which identifier you're talking about.

Are you sure you're linking SDL properly?
The function CreateTexture is the identifier not found. There are other identifiers not found. Like this instance of a struct that includes three ints and an SDL_Texture*. In that case, I use the keyword new to call the constructor and delete in the destructor. I have this instance in a class. Basically I'm getting this error "_____: identifier not found" for some things that I have 100% certainty about being declared before being called.

As to linking SDL, I always try to not copy and paste projects with SDL already linked because then I'll never memorize it. I always start fresh with an SDL project. And I've checked and double checked. I don't think it's the linker. The problem didn't arise until farther along the project and I didn't touch the project properties since the conception of it.

Re: Identifier not found when it is.... what?

Posted: Tue Sep 22, 2015 4:00 pm
by dandymcgee
Just to verify, you are using Visual Studio, correct? Do you have #include "SysFunc.h" in every file that calls CreateTexture? Have you done a Clean -> Rebuild all?

Edit: If you still can't figure it out, just .zip the whole project directory and upload it somewhere. It'll be much easier than guessing.