The last few days have been grappling with the problem of using VS2010 to compile CCV1.5 's vs2008 version of the project file failed. Looking for a long time on the internet, did not directly see such a post, estimated this comparison basis, then I will simply say that I encountered in the process of problems, hope to help the back to do the work of friends less detours.
First Use SVN in http://nuicode.svnrepository.com/svn/ccv15/ Download CCV1.5 source code, if your computer is equipped with VS2008, you can directly compile it, it can be directly compiled successfully, but not run, will prompt you to initialize the application failed, I did not carefully investigate the reasons, estimated is the problem of configuration. My computer is loaded with vs2010, so I compile it directly using VS2010.
When compiling with VS2010, you first need to modify ... \apps\addonsexamples\vs2008\community Core Vision.sln and ... The contents of the project file named Community Core Vision in the \apps\addonsexamples\vs2008\ directory, project ("{ 8bc9ceb8-8b4a-11d0-8d11-00a0c91bc942} ") =" Community core Vision "," Community core vision.vcproj ", modified to project (" { 8bc9ceb8-8b4a-11d0-8d11-00a0c91bc942} ") =" xxx "," xxx.vcproj ", where" xxx "represents your own defined name, and then the project file's name=" Community Core Vision "modified to name=" xxx, and the file names of these two files are also modified to XXX. After the modification is done, use VS2010 to open the solution file, preferably when the conversion is a backup is selected and the conversion log is displayed after the conversion is complete.
Turn on the conversion log to see hints such as Warning Msb8012:targetpath (...) does not match the Linker's OutputFile property value, meaning Macros ' targetpath ' and ' TargetName ' does not match the path and name of your output manifest file, it needs to be modified appropriately. My vs2010 is in the Chinese version, first click on the Engineering Properties-> property configuration-> The output directory on the regular page is set to \ bin, and the command entry in the Debug page is set to $ (TargetPath), which points to the \ccv1.5\apps\ Addonsexamples\vs2008\bin\xxx.exe, the compiled. exe file is in the bin directory, mainly for its ability to connect the DLL inside, and then the linker-> the output file entry in the regular page to $ (OutDir) XXX.exe This guarantees a match between the ' TargetName ' and the. exe file name. Why do you do this, you can see this blog.
When the above is set up, you can compile, the first compilation will prompt such an error:
1>c:\program Files\Microsoft Visual Studio10.0\vc\include\xxresult: Error C2825: ' _fty ': Must be a class or Namespa Cewhen followed by ':: '
1> C:\Program Files\Microsoft Visual Studio 10.0\vc\include\xxresult: [Reference to Class template Instantiatio n ' std::tr1::_result_type2<__formal,_fty,_arg0,_arg1> ' being compiled
1> with
1> [
1> __formal=false,
1> _fty=__w64 unsigned int,
1> _arg0=std::tr1::_nil,
1> _arg1=std::tr1::_nil &
1>]
1> C:\Program Files\Microsoft Visual Studio 10.0\vc\include\xxresult (597): [Reference to Class template Instantiati On ' std::tr1::_result_of2<_fty,_farg0,_farg1> ' being compiled
Wait, Xxresult is \microsoft in Visual Studio 10.0\vc\include\, there's no mistake, but what's the cause.
In fact, this is due to the bind () conflict between Winsock Bind () and TR1 (c + + technical 1) in VS2010. In VS2010, Microsoft declares bind () in TR1 in a namespace STD, and Winsock Bind () is declared in the global namespace, when using a "using namespace Std" in code After such a statement introduces the entire namespace, since there are two bind (), and TR1 bind () is a template that has a higher priority when compiler overload resolution is being invoked, a direct call to bind () will cause the TR1 to overwrite the Winsock call. The next type of error in the compile phase is not surprising.
The solution is simple, just let the compiler be able to distinguish between the two correctly. To resolve the conflicts caused by using the "using namespace Std", we need to explicitly declare a global call, such as ":: Bind ()", so that the compiler will only resolve the call to the function in the global domain without causing a conflict. If you encounter a similar situation later, you can resolve it through a global declaration (:: Call ()).
So the IF (m_hsocket (struct sockaddr*) &local,sizeof (local)) in the OfxTCPManager.cpp in CCV1.5 is changed to if (:: Bind (m_ Hsocket, (struct sockaddr*) &local,sizeof (local))
and OfxUDPManager.cpp int ret =bind (m_hsocket, (struct sockaddr*) &saserver,sizeof (STRUCTSOCKADDR)); instead of int ret =:: Bind (M_hsocket, (struct sockaddr*) &saserver,sizeof (STRUCTSOCKADDR)); this bind () function does not add:: When, compile in the VS2008 environment will not be wrong
Continue compiling after modification and then prompt for errors:
PocoFoundationmtd.lib (exception.obj): Error LNK2019: no T-¤¡§ solution A analysis of the ì of the ªa of the outside of the department, the symbol ¤? "__declspec (dllimport) public: __thiscallstd::basic_string<char,struct STD::CHAR_TRAITS<CHAR>,CLASSSTD:: Allocator<char> >::basic_string<char,structstd::char_traits<char>,class Std::allocator<char > > (structstd::basic_string<char,struct std::char_traits<char>,classstd::allocator<char> >::_has_debug_it) "(__imp_?? 0. $basic _string@du $char _traits@d@std@@v $allocator @d@2@ @std @ @QAE @u_has_debug_it@01@@z), ê the number ¨² letter ¡¥ " Protected: __thiscallpoco::exception::exception (int) "(?? 0exception@poco@ @IAE @h@z) d is à °y?
OpenframeworksLibDebug.lib (ofappglutwindow.obj): Error LNK2001: no T-¤¡§ solution A analysis of the Ì, outside ªa department "__declspec (dllimport) public: __thiscallstd::basic_string<char,struct STD::CHAR_TRAITS<CHAR>,CLASSSTD:: Allocator<char> >::basic_string<char,structstd::char_traits<char>,class Std::allocator<char > > (structstd::basic_string<char,struct std::char_traits<char>,classstd::allocator<char> >::_has_debug_it) "(__imp_?? 0. $basic _string@du $char _traits@d@std@@v? $allocator @d@2@ @std @ @QAE @u_has_debug_it@01@@z)
OpenframeworksLibDebug.lib (ofutils.obj): Error LNK2001: no T-¤¡§ solution A analysis of the ì of the ªa of the outside of the department, the symbol ¤? "__declspec (dllimport) public: __thiscallstd::basic_string<char,struct STD::CHAR_TRAITS<CHAR>,CLASSSTD:: Allocator<char> >::basic_string<char,structstd::char_traits<char>,class Std::allocator<char > > (structstd::basic_string<char,struct std::char_traits<char>,classstd::allocator<char> >::_has_debug_it) "(__imp_?? 0. $basic _string@du $char _traits@d@std@@v $allocator @d@2@ @std @ @QAE @u_has_debug_it@01@@z) and so on.
I saw this post on the forum and said to compile the whole openframeworks with vs2010. I will compile the whole openframeworks, note, before compiling the same as the first compile CCV when the configuration of the project files, the configuration is correct and then compile. Continue to compile CCV1.5 engineering files, and suggest some errors, the next error is basically to say what the external function can not resolve such errors, this error is mainly because in order to use the functions in the DLL, the corresponding function declaration in the. h does not correspond to the Lib library associated with it, that is, the compiler does not recognize the function in Lib, the source code is correct On the premise that this is related to the version, so I set the static link library directory and some of the additional dependencies of the VS2008 version to the VS2010 version, this is mainly based on error prompts to modify, prompted which Lib library has a problem, the version of the library to modify, I made the following changes:
Linker-> General-> Satellite Library directory. \.. \.. \libs\rtaudio\lib\vs2008 changed to.. \.. \.. \libs\rtaudio\lib\vs2010, ... \.. \.. \libs\poco\lib\vs2008 changed to.. \.. \.. \libs\poco\lib\vs2010
Enter-> Additional Dependencies ... \.. \.. \addons\ofxosc\libs\oscpack\lib\vs2008\oscpackd.lib changed to.. \.. \.. \addons\ofxosc\libs\oscpack\lib\vs2010\oscpackd.lib,
Then compile, run, succeed.