Page 1 of 1

Plugin help - Debug error

Posted: Wed Jan 05, 2011 8:40 pm
by papaya
Hey Ayman,

I've been having some trouble trying to build an OpenSim plugin. I've been following the directions in the Developer's guide (Chapter 3: Creating Your Own Analysis) and I've also checked around in the forum pages, but I haven't been able to find anything helpful. I've managed to go through steps 1 through 4 (Prepare a working directory --> Rename Template --> Run CMake --> Open the solution file OsimPlugin.sln), but every time I try and build my solution, I get this error message in Visual Studio:

------ Build started: Project: Libraries - osimPlugin, Configuration: Release Win32 ------
Compiling...
RegisterTypes_osimPlugin.cpp
..\plugin\RegisterTypes_osimPlugin.cpp(50) : error C3861: 'myAnalysisPlugin': identifier not found
myAnalysisPlugin.cpp
..\plugin\myAnalysisPlugin.cpp(56) : error C2653: 'myAnalysisPlugin' : is not a class or namespace name
..\plugin\myAnalysisPlugin.cpp(56) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Generating Code...
Build log was saved at "file://c:\OpenSimPlugin\pluginBuild\osimPlugin.dir\Release\BuildLog.htm"
Libraries - osimPlugin - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========

I've attached a link to a video of the whole process here if that's any help.

http://screencast.com/t/yZjV5Br3M42J

And here's an image of the files in my "plugin" folder
http://screencast.com/t/xNiDcHXbPii

I'm not sure where the error is -- I've gone through the other forum posts but haven't been able to figure it out from any of those posts.

Thanks a bunch,
adila

p.s. I replaced all the "AnalysisPlugin_Template" terms in the myAnalysisPlugin.h and myAnalysisPlugin.h files prior to doing anything to see if that would fix things (instead of doing a 'search and replace' on the entire solution after opening the OpenSimPlugin.sln solution file like suggested in the guide since that produced zero matches). I'm using CMake 2.6, Microsoft Visual C++ 2008 Express Edition and OpenSim 2.2 (released December 2nd 2010) if that's any help.


p.p.s. Here's the contents of the log file if that's any help:

Build Log Build started: Project: Libraries - osimPlugin, Configuration: Release|Win32
Command Lines Creating temporary file "c:\OpenSimPlugin\pluginBuild\osimPlugin.dir\Release\RSP00000121203152.rsp" with contents
[
/O2 /Ob2 /I "C:\OpenSim2.2\sdk\include" /I "C:\OpenSim2.2\sdk\include\xercesc" /I "C:\OpenSim2.2\sdk\include\SimTK\include" /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "CMAKE_INTDIR=\"Release\"" /D "OSIMPLUGIN_EXPORTS" /D "_WINDLL" /D "_MBCS" /FD /EHsc /MD /Fo"osimPlugin.dir\Release\\" /Fd"C:/OpenSimPlugin/pluginBuild/Release/osimPlugin.pdb" /W3 /c /TP /Zm1000

..\plugin\RegisterTypes_osimPlugin.cpp

..\plugin\myAnalysisPlugin.cpp
]
Creating command line "cl.exe @c:\OpenSimPlugin\pluginBuild\osimPlugin.dir\Release\RSP00000121203152.rsp /nologo /errorReport:prompt"
Output Window Compiling...
RegisterTypes_osimPlugin.cpp
..\plugin\RegisterTypes_osimPlugin.cpp(50) : error C3861: 'myAnalysisPlugin': identifier not found
myAnalysisPlugin.cpp
..\plugin\myAnalysisPlugin.cpp(56) : error C2653: 'myAnalysisPlugin' : is not a class or namespace name
..\plugin\myAnalysisPlugin.cpp(56) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Generating Code...
Results Build log was saved at "file://c:\OpenSimPlugin\pluginBuild\osimPlugin.dir\Release\BuildLog.htm"
Libraries - osimPlugin - 3 error(s), 0 warning(s)



RE: Plugin help - Debug error

Posted: Wed Jan 05, 2011 9:39 pm
by mkjung99
Hi adila,

After seeing your post, I tested the chapter 3 of the developers guide to build my own OpenSim plugin and it works very well.

I guess that you replaced all the "AnalysisPlugin_Template" terms in the
myAnalysisPlugin.h and myAnalysisPlugin.h files manually by yourself instead of using replacing function in the Visual Studio.

In the "C:\OpenSimPlugin\plugin" folder, there is another file that contains the term "AnalysisPlugin_Template". It is "RegisterTypes_osimPlugin.cpp" file. In the file you should replace this term as what you renamed.

"osimPluginDLL.h" and "RegisterTypes_osimPlugin.h" file don't need to be changed as you know.

Please check this.

I hope this helps you.

Best regards,
Moonki

P.S) We can get the Visual Studio 2005 and 2008 professional editions at https://www.dreamspark.com/ if we have a valid email address of our Universities.

RE: Plugin help - Debug error

Posted: Thu Jan 06, 2011 12:56 am
by papaya
Hi Moonki,

Thank you very much for your suggestion. I double checked the "RegisterTypes_osimPlugin.cpp" file and all the "AnalysisPlugin_Template" terms had been replaced with "myAnalysisPlugin", so I don't know if that's the problem.

When I initially tried using the 'find and replace' function in Visual Studio, it gave me the following message:

The following specified text was not found:
AnalysisPlugin_Template

That's why I ended up changing the text from within the individual files.

Do you think my error messages are related to the version of Visual Studio I've checked around in the forum, and other users seem to be using the same version as I am (Visual C++ 2008 Express Edition) with no trouble.

Thanks again for your help!
adila

RE: Plugin help - Debug error

Posted: Thu Jan 06, 2011 1:46 am
by papaya
Hey Moonki,

I managed to find the error in the code - the myAnalysisPlugin.h file didn't have all of the AnalysisPlugin_Template terms replaced.

The code compiles now, and the plugins are built in the "plugins" folder in my OpenSim2.2. directory. Success! :)
Hopefully, everything else will go smoothly from here on out.

Thank you very, very much for your help!

adila