Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7673085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:25:51+00:00 2026-05-31T16:25:51+00:00

I guess I’m doing something wrong with my includes but I just can’t seem

  • 0

I guess I’m doing something wrong with my includes but I just can’t seem to find what it is I am doing wrong. I am using visual studio 10 on a w7 64 bit system.

The compile errors I get:

testd.cpp(9): warning C4018: '<' : signed/unsigned mismatch
testd.cpp(21): warning C4018: '<' : signed/unsigned mismatch
testd.cpp(36): error C2065: 'tmp' : undeclared identifier
testd.cpp(37): error C2065: 'tmp' : undeclared identifier
testd.cpp(37): error C2227: left of '->getTestId' must point to class/struct/union/generic type
type is ''unknown-type''
testd.cpp(40): error C2065: 'tmp' : undeclared identifier
testd.cpp(41): error C2065: 'tmp' : undeclared identifier

So every time I am trying to make a new object (tmp) , he says “undeclared identifier”.
My guess is that he can’t get to the class definition of Test (aldho he doesn’t warn me),
but I don’t get why that is.. I reduced my code to a minimum, so that only the errorfunctions remain. Thanks in advance for your time

test.h: definition of a class Test, with 2 atributes, getters, setters, constructors and a destructor

#pragma once
class Test
{
private:
    int myTestId;
    string myTestNaam;    
public:
    Test();
    Test(string TestNaam,int TestId);
    ~Test();
    int getTestId();
    string getTestNaam();
    void setTestId(int TestId);
};

*test.cpp: definition of the functions for class Test

#include "stdafx.h"
#include "headers/Test.h"
Test::Test() {setTestId(0);}
Test::Test(string TestNaam, int TestId) {setTestId(TestId);}
Test::~Test() {}    
void Test::setTestId(int TestId) {myTestId=TestId;}
int Test::getTestId() {return myTestId;}

testd.h: definition of a class Testd, with static vector, and static functions

#pragma once
#include "Test.h"
class TestD
{
private:
    static vector<Test*> Testen;
    static int getPosition(int ID);
public:
    static Test* newTest(Test*);
    static Test* getTest(int ID);
};

testd.cpp: definition of the functions for class Testd

#include "StdAfx.h"
#include "headers/Test.h"
#include "headers/Testd.h"
vector<Test*> TestD::Testen = vector<Test*>();
Test* TestD::getTest(int ID)
{for(int i =0; i < Testen.size(); i++)
    {Test* tmp = Testen.at(i);
    if(tmp->getTestId() == ID)
    return tmp;
}
return 0;
}

int TestD::getPosition(int ID)
{for(int i = 0; i < Testen.size(); i++)
    {Test* tmp = Testen.at(i);
    if(tmp->getTestId() == ID)
    return i;
}
return -1;
}

Test* TestD::newTest(Test* Test)
{if(Test->getTestId()==-1)
    {Test* tmp = Testen.at(Testen.size()-1);
    int newId = tmp->getTestId()+1;
    Test->setTestId(newId);
    }
    Test* tmp = getTest(Test->getTestId());
    if(tmp==0)
{Testen.push_back(Test);
    return Test;
}
}

Finally i include my Stdafx.h

#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
//some includes are not used in the files I mentioned here, but other files need them

Thanks for your help and i hope I didn’t offend you by my poor English.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T16:25:52+00:00Added an answer on May 31, 2026 at 4:25 pm

    To start with, you can’t define a variable and name it the same way as an existing type:

    Test* TestD::newTest(Test* Test)
    

    Rename that Test variable.

    Then the signed-unsigned missmatch warning is caused because you are comparing the return value of std::vector::size, which a size_t, with an int:

    for(int i =0; i < Testen.size(); i++)
    

    Modify that i‘s type to size_t and you’ll remove that warning:

    for(size_t i =0; i < Testen.size(); i++)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i guess this is a really simple problem, but i just can't get it
My guess is it just made parsing easier, but I can't see exactly why.
I guess I've seen it somewhere before, but now I can't remember nor find
I guess this is covered somewhere but I'm not able to find. Guess I'm
I guess this is easy, I seem to be missing something simple. I need
I guess this is a bit of a noob question but I haven't seen
I guess its just due to my lake of jquery knowledge but ill lay
I guess it's a simple question, but how can I replace nil values in
I guess this should be an easy one cause I must be doing something
I guess the topic says it. I have tried googling this, but havent gotten

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.