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

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:
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.
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.

Related

Issue with executing .exe written in C++ (using mingw compiler)

I am new to programming and trying to learn C++ using C++ Primer (5th ed.). I have written this code that is directly from the book. The issue is when trying to execute the .exe results with this prompt popping up
The procedure entry point _ZNKSt9basic_ioslcSt11char_traitslcEEcvbEv could not be located in the dll
The .cpp
#include <iostream>
main ()
{
int sum = 0, val = 0;
while (std::cin >> val)
sum += val;
std::cout << "The sum is: " << sum << std::endl;
return 0;
}
Take a look at the directory where your mingw compiler is installed.
Within the "bin" directory you should finde several "*.dll" files like "libwinpthread-1.dll", "ligstdc++-6.dll" and so on...
These libraries are required to execute your application since mingw needs some platform wrapping magic (its a port of gcc for linux).
Try to copy these dll's into the same folder of where your "*.exe" is located.
If this does not help:
The error message is a bit confusing since I would expect it to report a dll file is missing instead of a missing procedure. In this case it looks like your compiler installation is broken or as already mentioned your build environment is not correctly set up. Which mingw version are you using, where did you get it from?

Struggling with libssh on Windows

The problem
I'm trying to build a project in Visual Studio 2015 on Win10 that makes use of libssh, but I'm having no luck getting it to work. I feel like I'm losing my mind here. I'm either completely blanking out or missing something incredibly obvious.
I've tried using the installer libssh-0.7.2-msvc.exe from the files section at https://red.libssh.org/projects/libssh/files. I then linked it to a test C++ project in VS2015. Using the sample code I'm able to compile it:
#include <iostream>
#define LIBSSH_STATIC
#include <libssh/libssh.h>
int main() {
std::cout << "Starting libssh test" << std::endl;
ssh_session my_ssh_session = ssh_new();
if (my_ssh_session == NULL) {
std::cout << "Failed to initialize" << std::endl;
}
ssh_free(my_ssh_session);
return 0;
}
(Note: I've tried both #define LIBSSH_STATIC and #define LIBSSH_STATIC 1 based on posts I've seen from my initial search for answers. I've even tried adding it to the preprocessor definitions in project properties.)
I can only compile it if my project is set to 32-bit, but I can't run the resulting executable. Doing so results in an error: "The code execution cannot proceed because ssh.dll was not found. Reinstalling the program may fix this problem." I'm statically linking ssh.lib, though, so I'm not sure why I'm even getting that error.
So I tried compiling libssh myself as 64-bit. It took some more tinkering than I expected (I had some issues with zlib, which eventually I just omitted since it's optional). I can compile my project as a 64-bit executable successfully, but once again, I can't actually run it. I get the same error about ssh.dll being missing.
For the sake of trying it, I removed the LIBSSH_STATIC define and tried to link just to the DLL. Copying the ssh.dll from the libssh distribution into my program folder and trying to run it, I get the error: "The application was unable to start correctly (0xc000007b). Click OK to close the application."
I'm not sure what I'm missing here, but I'm sure it's dumb and I'm overthinking it.
Project settings (all configurations, all platforms)
libssh is installed to G:\Libraries\libssh_0.7.2 on my machine.
Configuration Properties > VC++ Directories > Include Directories
G:\Libraries\libssh_0.7.2\include;$(IncludePath)
Configuration Properties > VC++ Directories > Library Directories
G:\Libraries\libssh_0.7.2\lib;$(LibraryPath)
Configuration Properties > Linker > Input > Additional Dependencies
ssh.lib;%(AdditionalDependencies)
libssh path summary
libssh_0.7.2
bin
ssh.dll
include
libssh
callbacks.h
legacy.h
libssh.h
libsshpp.hpp
server.h
sftp.h
ssh2.h
lib
ssh.lib
Install vkpkg
⊞ Win+X and open the powershell
Input vckpg install libssh:x64-windows
Integrate into Visual Studio: vcpkg integrate install
Then you can include <libssh.h> in Visual Studio.

What are the standard include paths for MS Visual C++?

I am trying to build a hello-world C++ application using Microsoft Visual C++.
#include <iostream>
int main() {
std::cout << "Hello, world. " << std::endl;
return 0;
}
I get this error:
main.cpp(1): fatal error C1083: Cannot open include file: 'iostream': No such file or directory
What are the standard include paths for Microsoft Visual C++?
Note: I am building from the command-line, not from Visual Studio
I actually just read through all of the documentation on this at: https://msdn.microsoft.com/en-us/library/ms235639.aspx
The material looks detailed and complete. If you get things configured like they require then it must work. They provide plenty of checks and conditions for ensuring that you are set up properly.
I am seriously suspecting that you aren't using a developer command prompt window.
I just did it myself and it works. Use Notepad and name the files like they tell you to do.
"Hello world!!"

vs2015 and vc++ external dependencies error on build

i am learning vc++ and i make my first application win32 console and just write simple code and i get 20 error from external files automatic included
i change compile as to c++ and not using precompiled headers but stil have errors
here is my code
#include <iostream>
int main()
{
//cout << "hello !" << endl;
return 0;
}
how can i fix it ?
Edit :
i have win7 and vs2015 perhaps helps
Edit 2:
last picture is for an empty project this one is for a win32 console app
I think you have created a project set to use precompiled header. Can you start with an empty project and add source file?
And don't forget to set "Not using precomplied header" in file option

Trying to set up the GNU C++ COMPILER, but I get an error I don't understand when I try to compile hello.cpp

So I bought this book called C++ Programming In Easy Steps by Mike McGrath online.
In the instructions it specifies to create a source file written in C++, the infamous "helo world". So I created my cpp file through sublime text editor and moved it to a file called MyPrograms in my C directory.
The code is as follows:
#include <iostream>
using std::cout;
using std::endl;
int main()
{
cout << "hello world"<< endl ;
return 0 ;
}
I have also tried:
#include
using namespace std;
int main()
{
cout << "hello world"<< endl ;
return 0 ;
}
Ok so I saved this file as hello.cpp in C:\MyPrograms.
Then here is where the error occurs....
I open cmd.
I do "c++"
I receive the message "c++: no input files".Which is what I'm supposed to recieve according to the book.
I proceed to do "cd\myprograms" to enter into the MyPrograms directory.
Once in that directory I do "c++ hello.cpp". According to the book this is supposed to compile my source file and create an executable file next to it. Instead I get a long error message that end in collect 2: 1d returned 1 exit status.
When I visit MyPrograms no executable file has been made next to the original cpp file.
I have also tried to do "c++ hello.cpp -o hello.exe" but it gives me the error again. All of this is done on the command prompt.
Please help :(
It looks to me like MinGW isn't installed properly.
First, it looks like you are trying to use version 4.0.3 but it may be conflicting with a version 3.4.5 that you installed previously (one in c:\mingw and the other in e:\p\giaw\src\pkg).
The latest version of MinGW is 4.7.2.1 which you can install from here: http://www.mingw.org/wiki/InstallationHOWTOforMinGW
But it looks like you're just starting out and it may be better to work with something that's better optimized for Windows (unless you're trying to compile Free Software). You can get a copy of Visual Studio Express for free here:
http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-desktop
There are older versions available as well if you scroll down (VSE 2010).