LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl ATL::CSimpleStringT
I dont get this error when I run step 1 which instruments and runs the code initially to generate the profile data to begin with.
Also if I run PGO through Visual Studio 2005 Professional. I can complete all the steps and generate a pgo optimized executable without any problems.
Anyone have any ideas ?
>>> I dont get this error when I run step 1
In step 1 (Qprof-gen) optimization is minimal. In this case iclmight not inline the functionand therefore must emit a body for it.
>>> When I run phase 3 of Profile Guided Optimizations through the Intel Compiler
In step 3 (Qprof-use) optimization is enable. Most likely you have an application that was using the non-inlined version of the function to resolve an unresolved reference in another file at link time. I would go back and look at the application and see if this is the case. One quick check is to see if /Qip or /Qipo is enable for the file where the function is defined. If it is, disable /Qip or /Qipo to see if you still get the unresolved error.
Disabling /Qip or /Qipo for that file is a quick workaround, but you will lose the benefits of inlining. The correct solutionis to find the file that is emitting an external unresolved call to this function, then fix the includes for the file so that you include the header file with the definition of this function.
I recently ran into this problem:
It turns out that:
1) test1.cpp has the definition of the function xxxyyy
2) mytest.h has the declaration for this function
3) test2.cpp reference the function xxxyyy.
4) both test1.cpp and test2.cppincludes myheader.h which has the function declaration.
With /Qip enable, function xxxyyy was inlined, and no function body was emitted. To resolve this problem, I move the definition of xxxyyy from test1.cpp to myheader.h.
Hope this helps.