I followed all the steps to a tee and successfully compiled a ElasticPPcpp.dll file using Visual Studio Express 2013. After I copied the .dll file to the ..\DEVELOPER\material\cpp directory, I ran the example file in OpenSees from the command prompt and changed directories accordingly. It spat out "WARNING could not create uniaxialMaterial ElasticPPcpp," like the dll didn't even exist.
I recompiled the file a couple of times (by deleting everything and starting over) but to no avail and I'm at my wits end. I would appreciate any help if possible. Some more information:
IDE - Visual Studio Express 2013
OpenSees v2.4.4 (latest)
SVN Build 5814
Thanks in advance.
I had same problem with you. but after using 32-bit version of OpenSees, it worked perfectly fine.
so i tried existing material in OpenSees SVN.
all i did was modify every words (which was, 'ElasticMaterial') to "MyTestMaterial" in "ElasticMaterial.cpp" and "ElasticMaterial.h" to see if new OpenSees command is working.
(e.g. uniaxialMaterial MyTestMaterial $matTag $E <$eta> <$Eneg> )
I successfully created "MyTestMaterial.dll" by following the tutorial, but OpenSees spat out like : WARNING could not create uniaxialMaterial MyTestMaterial
(I also tried modifying Steel01 OpenSees command: Steel01 to trialMat01, but it didn't work also.)
I have no idea what is wrong with 'MyTestMaterial.dll'.
All i need to do was to change 'OPS_ElasticPPcpp' to 'OPS_MyMat' to implement my material to OpenSees, instead of changing every 'ElasticPPcpp' to 'MyMat'.
and i also solved the problem for other materials (such as, Steel01)
#define OPS_Export extern "C" _declspec(dllexport)
#define OPS_Export extern "C" __attribute__((visibility("default")))
#define OPS_Export extern "C"
should be included before 'OPS_MyMat' starts, as masual said.
and now I have another question.
for some existing materials(such as, Pinching4Material and ElasticMaterial, etc.), external procedure is not included.
How do i modify OpenSees material command from 'Pinching4' to 'MyMat' for cases like this?
I'm very much apprreciated with your kind advice.
for Pinching4 material, external procedure is not included.
so i added one from "elasticPPcpp", as fmk adviced.
finally, modified 'Pinching4' (which is 'MyMat') seems to work well.
and i have one more question.
I'm trying to save a variable included in 'Pinching4'.(it can be any variables. in this case, Tstrain)
ofstream outputFile(myString, ios::out | ios::app);
sprintf(myString, "%20.8e", Tstrain);
outputFile << myString << endln;
procedure during "int Pinching4Material::commitState(void)".
I successfully saved variable 'Tstrain' as 'Tstrain.txt'.
but when i used this method, analysis time greatly increased.
is this because i implemented this code in "commitState"?
I tried building a DLL for ElasticPPcpp as demonstrated in the example with the latest Developer in MS Visual Studio 2010. But I got two error messages:
Error 2 error C2733: second C linkage of overloaded function 'ops_getstring' not allowed i:\2015\c plus plus practice\3_elasticppcpp with new developer\developer\core\win32functions.cpp 217
Error 31 error C1083: Cannot open include file: 'EigenSOE.h': No such file or directory i:\2015\c plus plus practice\3_elasticppcpp with new developer\developer\core\incrementalintegrator.cpp 41
The code for win32functions.cpp in the trunk
http://opensees.berkeley.edu/WebSVN/fil ... ctions.cpp is a little different from the one I got downloaded from svn in the following lines:
typedef const char *(*OPS_GetStringType)();
extern "C" const char *OPS_GetString()
I could not find this declaration and definitions in any of the previous versions of revision or the current version in the trunk.
As for the IncrementalIntegrator.cpp, do I need to download EigenSOE.h? It isn't in the core directory.
So, what I did was to use an older Developer. win32functions.cpp did not give the C2733 error; OPS_GetString had a different declaration and definition. And, IncrementalIntegrator.cpp did not icnlude a EigneSOE.h.
On doing so, I successfully compiled the dll. But when I run it in the command prompt, it gives the error:
WARNING could not create uniaxialMaterial ElasticPPcpp
"uniaxialMaterial ElasticPPcpp 1 3000 0.001"
(file "example1.tcl" line 22)
The tcl script, ElasticPPcpp.dll and OpenSees.exe are in the same folder.
I did see the recommendation to use 32-bit OpenSees.exe. But can't I get around this problem with a 64-bit OpenSees.exe?
you successfully created dll, but failed to run it on OpenSEES 64-bit?
how about using 32-bit OpenSEES to see if dll has error?
and for downloading missing files, my problem solved when I added missing files.
Yes, I successfully created dll but failed to run it in OpenSees 64-bit. I'd prefer it if I can run it in the 64-bit, without resorting to 34-bit.
As for the missing files, they aren't in the core directory. You mean to say, I could just use a different filepath and download from svn? I actually copied those files from the OpenSees/trunk/src/system_of_eqn/eigenSOE/EigenSOE.h and added whatever file popped up as missing, but it just kept asking for another file until I couldn't find the last one.
Visual studio : I drag & dropped missing files in the 'Source Files' folder located in the solution explorer.
OS X :
method one - simply copy missing files in the same folder where "makefile" exists.
or method two - add more file path to the variable "INCLUDE" in the makefile.def.
and here's some questions i would like to ask.
1) is 64-bit OpenSees any better than 32-bit one? if not, it'd be better to use 32-bit OpenSees
2) how did you successfully created dll, while some files are missing?
Where did you get those missing files? I copied and pasted the code(which I found in the Opensees/trunk/src) and created a header or a cpp file by myself as required. But I guess there's another way around it. I am using VisualStudio 2010.
I used an older Developer/core to build the dll, which didnot give me any error for the win32functions.cpp nor the IncrementalIntegrator.cpp(EigenSOE.h was included within this cpp in the latest Developer; I checked in the older one, it was not there.). That's how I built the dll.
As for the 64-bit or 32-bit, just wanted to know if I could get around the problem with 64-bit. Sure, I will go for 32-bit.
but searching missing files and then pasting into my additional library (or core folder) solved the issue.
first of all, I downloaded whole files from OpenSees svn. (http://opensees.berkeley.edu/OpenSees/developer/svn.php)
while building custom materials, whenever error messages('missing files') pop up, i searched the whole svn directory and copied necessary files into my library.
i believe 'EigneSOE.h.' is located in /SRC/system_of_eqn