Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 609
  • Last Modified:

namespace conflict

I used STL and GDIplus in my program. I got a compilation error with the following declaration :

#include <gdiplus.h>
using namespace Gdiplus;
#include <vector>
using namespace std;


How do I resolve the compilation error ?

Thank you!
0
kctan100
Asked:
kctan100
1 Solution
 
jhanceCommented:
>>a compilation error

Is it possible that you might be specific and say WHAT compiler error?  Or is this some sort of test?

>>How do I resolve the compilation error ?

Whatever you're doing wrong, FIX it!
0
 
peterchen092700Commented:
What jhance is trying to tell you: We need more information to help you. What error(s) do you get?
0
 
kctan100Author Commented:
I got this error :

d:\program files\microsoft sdk\include\gdiplusflat.h(267) : error C2955: 'iterator' : use of class template requires template argument list
        d:\program files\microsoft visual studio\vc98\include\utility(71) : see declaration of 'iterator'
0
 
fl0ydCommented:
Don't use

"using namespace Gdiplus;" and
"using namespace std;"

Resolve the namespaces manually when you actually need to. For example, write
std::vector<int> int_vector;
instead of
vector<int> int_vector;

If you cannot go without your "using ..."-directives at least place them AFTER all your includes. These directives are in effect from the line they are first discovered to the end of the file.

Did that solve your problems?
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now