We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,430 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Does not name a type

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.

3
Contributors
2
Replies
22 Hours
Discussion Span
2 Years Ago
Last Updated
3
Views
Gnomy
Newbie Poster
1 post since Apr 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Please post a complete program that exhibits the problem.

Narue
Bad Cop
Team Colleague
15,460 posts since Sep 2004
Reputation Points: 6,483
Solved Threads: 1,407
Skill Endorsements: 54

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;
}
template<>
Junior Poster
165 posts since Feb 2011
Reputation Points: 84
Solved Threads: 26
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0730 seconds using 2.67MB