Discussion:
compiling and linking C/C++ user subroutine
Antonio Lorenzo Mendicino
2007-05-24 21:43:01 UTC
Permalink
Dear all

I want run an abaqus simulation with a user subroutine written in C/C++.
I have downloaded one from abaqus online support system answer 737.

I don't know how can I do this so I tried as it follows and I get:


C:\Documents and Settings\alorenzom\Documenti\HC3FEM\AbaqusUSrI>abaqus make libr
ary=visco.c
ABAQUS Error: The following file(s) could not be located: visco.c.for
ABAQUS requires an appropriate input file(s) to compile the user routine.
The ABAQUS Make execution procedure exited with errors

I know that in abaqus environment file there is compile_cpp parameter which contains c++ compile command.It appears like this

compile_cpp=['cl', '/c', '/nologo', '/W0', '/MD',
'/TP', '/GX', '/DNDEBUG', '/DWIN32', '/DTP_IP', '/D_CONSOLE',
'/DNTI', '/DFLT_LIC', '/DOL_DOC', '/D__LIB__', '/DHKS_NT',
'/DFAR=', '/D_WINDOWS', '/O1', '/I%I']


and I don't know how I can use this information.

If it could be useful:I work on windows/x86-32.I have installed intel fortran compiler9.1,ms vc++7.1,ms platform sdk 2003.I run an abaqus analysis with a fortran user subroutine successfully.

Has any one got any suggestions for me?

Thanks a lot in advance.

_________________________________________________
Antonio Lorenzo Mendicino
***@libero.it


------------------------------------------------------
Leggi GRATIS le tue mail con il telefonino i-modeĀ™ di Wind
http://i-mode.wind.it/
Fernando
2007-05-25 15:14:42 UTC
Permalink
Hi Antonio,
Post by Antonio Lorenzo Mendicino
I want run an abaqus simulation with a user subroutine written in
C/C++. I have downloaded one from abaqus online support system
answer 737.
C:\Documents and
Settings\alorenzom\Documenti\HC3FEM\AbaqusUSrI>abaqus make
library=visco.c
visco.c.for ABAQUS requires an appropriate input file(s) to compile
the user routine. The ABAQUS Make execution procedure exited with
errors
Note that ABAQUS "understood" that you were trying to compile a
fortran file (visco.c.for), which is evidently wrong. Try the
following: compile the visco.c file into visco.obj with the command
line version of the C compiler. Then run abaqus job=xxx obj=visco.obj

This has the additional advantage that you can keep the object file,
which will save you a couple of minutes from the compilation --only
the linking phase will be carried out-- if you submit the analysis
often (note that you need to recompile after each modification to the
source file!).

Hope this helps,
Fernando
alorenzom_lollo
2007-05-28 10:06:00 UTC
Permalink
Thanks a lot.

Here what occurs trying to compile by VC compiler command line
version:
------------------------------------------------------------------

C:\Documents and Settings\alorenzom\Documenti\HC3FEM\AbaqusUSrI>cl
visco.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for
80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

visco.c
visco.C(107) : error C2059: syntax error : 'string'
visco.C(134) : error C2143: syntax error : missing ';' before 'type'
visco.C(134) : error C2143: syntax error : missing ';' before 'type'
visco.C(134) : error C2143: syntax error : missing ')' before 'type'
visco.C(134) : error C2143: syntax error : missing ';' before 'type'
visco.C(134) : error C2065: 'k1' : undeclared identifier
visco.C(134) : warning C4552: '>=' : operator has no effect; expected
operator w
ith side-effect
visco.C(134) : error C2059: syntax error : ')'
visco.C(135) : error C2143: syntax error : missing ';' before '{'
visco.C(136) : error C2043: illegal break
visco.C(139) : error C2143: syntax error : missing ';' before 'type'
visco.C(140) : error C2065: 'cString' : undeclared identifier
visco.C(140) : warning C4022: 'memcpy' : pointer mismatch for actual
parameter 1

visco.C(141) : error C2109: subscript requires array or pointer type
visco.C(142) : warning C4047: 'return' : 'char *' differs in levels
of indirecti
on from 'int'
------------------------------------------------------------------

Here what occurs trying to compile by borland builder c compiler
command line version:
------------------------------------------------------------------
C:\Documents and Settings\alorenzom\Documenti\HC3FEM\AbaqusUSrI>bcc32
visco.c
Borland C++ 5.6 for Win32 Copyright (c) 1993, 2002 Borland
visco.C:
Error E2040 visco.C 107: Declaration terminated incorrectly
*** 1 errors in Compile ***

C:\Documents and Settings\alorenzom\Documenti\HC3FEM\AbaqusUSrI>

------------------------------------------------------------------
Fernando
2007-05-28 13:04:04 UTC
Permalink
Hi Antonio,
Post by alorenzom_lollo
Here what occurs trying to compile by VC compiler command line
visco.c
visco.C(107) : error C2059: syntax error : 'string'
[...]
Post by alorenzom_lollo
Here what occurs trying to compile by borland builder c compiler
------------------------------------------------------------------
C:\Documents and Settings\alorenzom\Documenti\HC3FEM\AbaqusUSrI>bcc32
visco.c
Borland C++ 5.6 for Win32 Copyright (c) 1993, 2002 Borland
Error E2040 visco.C 107: Declaration terminated incorrectly
*** 1 errors in Compile ***
Both compilers agree to complain at line 107 of your source file,
which is a very clear hint. I would say that you don't have the
"#include<string>" line, or else that you are missing a "use namespace
std" (in order to be able to address "string" as such, instead of
"std::string".

Hope this helps,
Fernando
alorenzom_lollo
2007-05-29 17:01:19 UTC
Permalink
I modified my extension file from .c to .cpp and I add it to an
empty .net project in Ms Development Environment 2003.
I compiled it successfully.

I try to run my abaqus procedure and I get

C:\Documents and
Settings\alorenzom\Documenti\HC3FEM\AbaqusUSrI>abaqus -j visco_
dload -user visco.obj interactive
Old job files exist. Overwrite? (y/n): y
ABAQUS JOB visco_dload
ABAQUS Version 6.6-1
Begin Linking ABAQUS/Standard User Subroutines
5/29/2007 6:50:09 PM
Creating library standardU.lib and object standardU.exp
MSVCRT.LIB(checkclr.obj) : warning LNK4210: .CRT section exists;
there may be un
handled static initializers or terminators
MSVCRT.LIB(secchk.obj) : warning LNK4210: .CRT section exists; there
may be unha
ndled static initializers or terminators
End Linking ABAQUS/Standard User Subroutines
5/29/2007 6:50:09 PM
Begin Analysis Input File Processor
5/29/2007 6:50:09 PM
Run pre.exe
ABAQUS License Manager checked out the following licenses:
ABAQUS/Standard checked out 5 tokens.
<13 out of 18 licenses remain available>.
5/29/2007 6:50:10 PM
End Analysis Input File Processor
Begin ABAQUS/Standard Analysis
5/29/2007 6:50:10 PM
Run standard.exe
ABAQUS License Manager checked out the following licenses:
ABAQUS/Standard checked out 5 tokens.
<13 out of 18 licenses remain available>.
5/29/2007 6:50:10 PM
ABAQUS Error: ABAQUS/Standard Analysis exited with an error - Please
see the
message file for possible error messages if the file exists.
ABAQUS/Analysis exited with errors

C:\Documents and Settings\alorenzom\Documenti\HC3FEM\AbaqusUSrI>

Perhaps I should pay attention for something in link_sl parameter in
abaqus env file?
alorenzom_lollo
2007-05-30 17:11:06 UTC
Permalink
I solve my problem.Thank you to all and special thanks to fcn_public.
Fernando
2007-05-31 16:20:29 UTC
Permalink
Hi Antonio,
Post by alorenzom_lollo
I solve my problem.Thank you to all and special thanks to fcn_public.
Do you still remember how you solved it? I could not think of other
alternatives than what I proposed, other than "play around" --which I
thought you were already doing.

I'm quite sure many users will apreciate your first-hand report :-)

Regards,
Fernando

Antonio Lorenzo Mendicino
2007-05-29 11:26:31 UTC
Permalink
I compile successfully my c file with Ms Development Environment 2003, adding it to a project (named only_for_compile_an_existing_unit) and modifying some project properties, but I can't find corresponding object file.I expected it in Debug folder but it isn't there.

Here is the message I get in IDE:

------ Build started: Project: only_for_compile_an_existing_unit, Configuration: Debug Win32 ------

Compiling...
visco.C

Build log was saved at "file://c:\Documents and Settings\alorenzom\Documenti\Hc3fem\AbaqusUSrI\only_for_compile_an_existing_unit\Debug\BuildLog.htm"
only_for_compile_an_existing_unit - 0 error(s), 0 warning(s)


---------------------- Done ----------------------

Build: 1 succeeded, 0 failed, 0 skipped
_________________________________________________
Antonio Lorenzo Mendicino
***@libero.it


------------------------------------------------------
Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom
http://click.libero.it/infostrada
alorenzom_lollo
2007-05-29 21:42:32 UTC
Permalink
I modified in visco.cpp properties pages, debug information
format=disabled.I compile successfully.Here what I get trying to run
my analysis

C:\Documents and
Settings\alorenzom\Documenti\HC3FEM\AbaqusUSrI>abaqus -j visco_
dload -user visco.obj interactive
Old job files exist. Overwrite? (y/n): y
ABAQUS JOB visco_dload
ABAQUS Version 6.6-1
Begin Linking ABAQUS/Standard User Subroutines
5/29/2007 11:32:42 PM
Creating library standardU.lib and object standardU.exp
End Linking ABAQUS/Standard User Subroutines
5/29/2007 11:32:42 PM
Begin Analysis Input File Processor
5/29/2007 11:32:42 PM
Run pre.exe
ABAQUS License Manager checked out the following licenses:
ABAQUS/Standard checked out 5 tokens.
<13 out of 18 licenses remain available>.
5/29/2007 11:32:43 PM
End Analysis Input File Processor
Begin ABAQUS/Standard Analysis
5/29/2007 11:32:43 PM
Run standard.exe
ABAQUS License Manager checked out the following licenses:
ABAQUS/Standard checked out 5 tokens.
<13 out of 18 licenses remain available>.
5/29/2007 11:32:44 PM
ABAQUS Error: ABAQUS/Standard Analysis exited with an error - Please
see the
message file for possible error messages if the file exists.
ABAQUS/Analysis exited with errors

C:\Documents and Settings\alorenzom\Documenti\HC3FEM\AbaqusUSrI>

and in msg file 'user subroutine dload missing'
Loading...