I've been searching this for a little while now and I'm absolutely unable to figure out what the problem is.

This is the code I'm having the issue with:

std::vector<std::string> TexName;
TexName.push_back("mega.png");

and I get...

error: 'TexName' does not name a type

I've included both vector and string library, theres no name conflicts, and I've tried using namespace std; but it didn't work. While searching I seen other people using similar code; with the vector of strings, and it seemed to work with them.

Any help plz?

EDIT:

I figured it out. I didn't have it in a function. Oops. Thanks for your time.

Recommended Answers

All 2 Replies

Please post a complete program that exhibits the problem.

Seems, fine, ensure you have the correct headers.

#include <vector>
#include <string>

int main()
{
    std::vector<std::string> TexName;
    TexName.push_back("mega.png");
    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.