When you try compiling your program, try this:
g++ -o myprogram myprogram.cpp `pkg-config --cflags --libs gmime-2.6`
The problem is that you need to tell the compiler which include paths to use (--cflags) and what library paths to use (--libs).
When compiling individual sources, you could do:
g++ -o file.o -c file.cpp `pkg-config --cflags gmime-2.6`
And then use pkg-config --libs gmime-2.6
for the final step.