Fortran 90 Interface for IPOPT - fortran

I have tried the pyipopt to run IPOPT. That works well.
But I am using Fortran 90 now. I look into the example hs071_f in IPOPT for the Fortran interface. I guess it is written in Fortran 77? Unfortunately, I really don't understand.
I was wondering whether there was a Fortran 90 interface?
Though I just found a Fortran90 Interface Source from http://apmonitor.com/wiki/index.php/Main/DownloadIpopt, I cannot build it. Is it because I am using Mac but the source is for Windows?
Errors:
gfortran hs071.f90 -o vfi.out -fbounds-check -O2
Undefined symbols for architecture x86_64:
"_ipaddintoption_", referenced from:
_MAIN__ in cculABQh.o
"_ipaddnumoption_", referenced from:
_MAIN__ in cculABQh.o
"_ipaddstroption_", referenced from:
_MAIN__ in cculABQh.o
"_ipcreate_", referenced from:
_MAIN__ in cculABQh.o
"_ipfree_", referenced from:
_MAIN__ in cculABQh.o
"_ipopenoutputfile_", referenced from:
_MAIN__ in cculABQh.o
"_ipsolve_", referenced from:
_MAIN__ in cculABQh.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
Looking forward to anyone's advice! Thanks in advance!

Related

How do I fix my current openGL error, my cmakelist may be my issue [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 10 months ago.
Improve this question
I have included the library <GLUT/glut.h> and all my syntax is correct, yet I am receiving this error.
Undefined symbols for architecture arm64:
"_glBegin", referenced from:
triangle(float*, float*, float*) in main.cpp.o
"_glClear", referenced from:
displayTriangle() in main.cpp.o
"_glClearColor", referenced from:
_main in main.cpp.o
"_glColor3f", referenced from:
drawTetrahedron(int) in main.cpp.o
"_glEnable", referenced from:
_main in main.cpp.o
"_glEnd", referenced from:
triangle(float*, float*, float*) in main.cpp.o
"_glFlush", referenced from:
displayTriangle() in main.cpp.o
"_glLoadIdentity", referenced from:
displayTriangle() in main.cpp.o
"_glMatrixMode", referenced from:
reshapeWindow(int, int) in main.cpp.o
"_glOrtho", referenced from:
reshapeWindow(int, int) in main.cpp.o
"_glVertex3fv", referenced from:
triangle(float*, float*, float*) in main.cpp.o
"_glViewport", referenced from:
reshapeWindow(int, int) in main.cpp.o
"_glutCreateWindow", referenced from:
_main in main.cpp.o
"_glutDisplayFunc", referenced from:
_main in main.cpp.o
"_glutInit", referenced from:
_main in main.cpp.o
"_glutInitDisplayMode", referenced from:
_main in main.cpp.o
"_glutInitWindowSize", referenced from:
_main in main.cpp.o
"_glutMainLoop", referenced from:
_main in main.cpp.o
"_glutPostRedisplay", referenced from:
reshapeWindow(int, int) in main.cpp.o
"_glutReshapeFunc", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
My cmakefile I feel like is my issue, but I have no idea where to begin.
Please provide more details like your relevant section of CMakeLists.txt for getting more info and getting quicker help from community.
Now, coming to the error logs, it seems you are cross-compiling the source files using a arm-based compilers.
The error message "ld: symbol(s) not found for architecture arm64" looks to me as a linker issue and you should be having the find_package() and linking calls in CMakeLists.txt for OpenGL.
So to start with , you should follow two steps initially and see if it solves your problem:
1. Make sure the CMake build system is pointing to correct compiler tool chain path (arm compilers in here).
Refer official website of CMake for same:
https://cmake.org/cmake/help/book/mastering-cmake/chapter/Cross%20Compiling%20With%20CMake.html
2. Make sure you are linking OpenGL
find_package(OpenGL REQUIRED)
target_include_directories(your_executable_name PUBLIC ${OPENGL_INCLUDE_DIR})
target_link_libraries(your_executable_name PUBLIC ${OPENGL_LIBRARIES})

Compiling Fortran code that use hplots

I am working on a Fortran code that plots some data and I am having the following error:
Undefined symbols for architecture x86_64:
"_hplots_", referenced from:
_MAIN__ in ifortaBEBFS.o
_clspak_ in ifortaBEBFS.o
_opnpak_ in ifortaBEBFS.o
"_number_", referenced from:
_MAIN__ in ifortaBEBFS.o
(maybe you meant: _for__this_image_number_or_zero)
"_plot_", referenced from:
_MAIN__ in ifortaBEBFS.o
_pltline_ in ifortaBEBFS.o
ld: symbol(s) not found for architecture x86_64
The error comes from:
character*32 filenm
open(8,file=filenm)
call hplots(1,1,8,0)
return
end
I am just trying to compile the .f code with ifort or gfortran.
The code comes from the following git repository https://github.com/usgs/finite-fault/blob/db126a5e05dd2ca1950909ac0be9811cfe115019/src/plot/vangodshJ.f
First I didnt had Generic Mapping Tools so I had to install it. Also the program needed two other fortran codes that were not in the same folder so moving them to the same folder and compiling it as follows solved the problem.
ifort vangodshJ.f calpak.f laspac.f -o vangodshJ.out

Build Error when compiling c++ code which includes MATLAB Engine Library

I have Simple c++ Code that works fine while also using #include "engine.h" for the use of MATLAB in the c++ code.I am also using some functions like mxArray(), mxCreateDoubleMatrix() & mxSetPr(). After going to terminal and compiling the code with g++ -o main main.cpp the following errors occur
Undefined symbols for architecture x86_64:
"_engClose", referenced from:
_main in main-438cf4.o
"_engEvalString", referenced from:
_main in main-438cf4.o
"_engOpen", referenced from:
_main in main-438cf4.o
"_engPutVariable", referenced from:
_main in main-438cf4.o
"_mxCreateDoubleMatrix_730", referenced from:
_main in main-438cf4.o
"_mxSetPr", referenced from:
_main in main-438cf4.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I don't think I need to put my actual code here since I am assuming this error has to do with compatibility issues not the code itself. If i'm wrong I will edit the post
P.S. I am using os Sierra. ( i have also tried compiling with xcode 9.0.1, same errors occur)
Thanks

installing a c++ wrapper for libcurl on OS X [duplicate]

Really stupid C question.
I'm trying to build the source code here so I can start on modifying it for myself
http://curl.haxx.se/libcurl/c/ftpget.html
I download the file, then run
gcc -o test ftpget.c
and get
Undefined symbols:
"_curl_global_init", referenced from:
_main in ccFchguB.o
"_curl_easy_perform", referenced from:
_main in ccFchguB.o
"_curl_easy_setopt", referenced from:
_main in ccFchguB.o
_main in ccFchguB.o
_main in ccFchguB.o
_main in ccFchguB.o
"_curl_easy_cleanup", referenced from:
_main in ccFchguB.o
"_curl_easy_init", referenced from:
_main in ccFchguB.o
"_curl_global_cleanup", referenced from:
_main in ccFchguB.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
which makes no sense to me, because
/usr/local/include/curl/curl.h
exists and has these functions. I'm sure this is some basic c compilation thing I'm missing.
Many thanks for any pointers.
You need to link with the curl library:
gcc -o test ftpget.c -lcurl

Poco C++ library on OSX 10.8.2: Undefined symbols for architecture x86_64

I'm trying to use Poco C++ library to do the simple http requests in C++ on Mac OS X 10.8.2. I installed Poco, copy-pasted the http_request.cc code from this tutorial, ran it with 'g++ -o http_get http_get.cc -lPocoNet', but got:
Undefined symbols for architecture x86_64:
"Poco::StreamCopier::copyStream(std::basic_istream<char, std::char_traits<char> >&, std::basic_ostream<char, std::char_traits<char> >&, unsigned long)", referenced from:
_main in ccKuZb1g.o
"Poco::URI::URI(char const*)", referenced from:
_main in ccKuZb1g.o
"Poco::URI::~URI()", referenced from:
_main in ccKuZb1g.o
"Poco::URI::getPathAndQuery() const", referenced from:
_main in ccKuZb1g.o
"Poco::URI::getPort() const", referenced from:
_main in ccKuZb1g.o
"Poco::Exception::displayText() const", referenced from:
_main in ccKuZb1g.o
"typeinfo for Poco::Exception", referenced from:
GCC_except_table1 in ccKuZb1g.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Have been struggling with this for couple of hours. Any idea how to fix this? Thanks in advance!
the Poco::URI, Poco::StreamCopier classes are in the PocoFoundation library, so you will need to link to that library also.
g++ -o http_get http_get.cc -lPocoNet -lPocoFoundation
You don't appear to have specified the include path for the library and the library to use when compiling your source.
You need to provide the -I and the -L directive to g++ to specify the include path for the library and the library itself respsectively.