Solved

namespace conflict

Posted on 2002-06-22
4
604 Views
Last Modified: 2013-12-03
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
Comment
Question by:kctan100
4 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 7101508
>>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
 
LVL 7

Expert Comment

by:peterchen092700
ID: 7101971
What jhance is trying to tell you: We need more information to help you. What error(s) do you get?
0
 

Author Comment

by:kctan100
ID: 7102479
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
 
LVL 8

Accepted Solution

by:
fl0yd earned 50 total points
ID: 7102684
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question