简体   繁体   中英

Reference Abaqus C++ API static libraries to read ODB files

I have Abaqus CAE, Visual Studio 2017, Visual C++ compiler installed in my computer. I'm trying to reference Abaqus CAE's static libraries in my Visual Studio C++ project to read my ODB file.

This is the code file that I'm trying to compile & execute :

```

#include "pch.h"
#include <iostream>
#include <odb_API.h>
#include <odb_String.h>
#include <odb_Repository.h>

using namespace std;
int main()
{
    cout << "Initializing API"<<endl;
    odb_initializeAPI();
    odb_String odbFilePath = "C:\\Users\\Dularish\\Desktop\\Temp_Toclear\\Job-1.odb";

    try
    {
        odb_Odb& odb = openOdb(odbFilePath);

        odb.close();
    }
    catch (odb_BaseException& ex) 
    {
        cout << "Exception message : " << ex.UserReport().CStr() << endl;
    }
    catch (const std::exception& ex)
    {
        cout << "Default Exception message : " << ex.what() << endl;
    }

    cout << "Hello World!\n"; 

    odb_finalizeAPI();

    return 0;
}

```

Visual Studio Project Settings :

Platform : X64 (I'll not be able to compile with X86)

Configuration Properties > VC ++ Directories > Include Directories : C:\\SIMULIA\\Abaqus\\6.14-3\\code\\include;$(IncludePath)

Configuration Properties > VC ++ Directories > Library Directories : C:\\SIMULIA\\Abaqus\\6.14-3\\code\\lib;$(LibraryPath)

Configuration Properties > Linker > Input > Additional Dependencies :

ABQDMP_Core.lib; ABQSMAAbuBasicUtils.lib .... and all the rest of the files present in the directory "C:\\SIMULIA\\Abaqus\\6.14-3\\code\\lib".

With these settings, I'm able to compile it without any errors, but on execution of exe application,

I'm getting the below error :

"The procedure entry point ?openOdb@@YAAEAVodb_Odb@@AEBVodb_String@@_N1VSMABasStringMode@@@Z could not be located in the dynamic link library ABQSMAOdbApi.dll"

Error Screenshot

Does it mean that I'm missing a static library containing openOdb method?

I'm trying to connect with people who are already familiar with Abaqus ODB C++ API who could help me on this.

Thanks.

Edit 1 : I don't want to use abaqus make utility because I want to build my own postprocessing application based on .NET platform. The lines "odb_initializeAPI();" and "odb_finalizeAPI();" are the lines which should be used if I want to access Abaqus ODB API outside Abaqus CAE. I'm actually following this page from the scripting documentation " http://130.149.89.49:2080/v2016/books/cmd/default.htm?startat=pt05ch10s07.html "

The other resource that guided me to use this approach : " https://www.reddit.com/r/fea/comments/8oqx5x/setting_up_abaqus_c_interface/ "

There are at least two issues with your solution and approach:

  1. The program you write must not contain a C++ main routine, aka the function main . Instead, the entry point for the program must be a function named ABQmain , having the same signature as the regular function main .
  2. You must compile your Abaqus C++ code using the Abaqus make utility. Once you have finished writing your code and would like to compile it, the correct command to use is:

    abaqus make job=your_code.cpp

If you have Abaqus on your machine, then you should also have the documentation. The section "Abaqus Scripting User's Guide" contains a section "Using C++ to access an output database." There you can find some examples and the details I've pointed out here. It should be a good starting point for your work.

EDIT: After pointing out that you wish to use the Visual Studio for development and compilation, make sure to check the system requirements for the Abaqus version you are using. Try to use the same Visual Studio C++ compiler as the one used for compiling Abaqus. Simulia is most probably using an older version of the Visual Studio C++ compiler than you are.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM