I am trying to compile a fortran code which was last compiled in early 90's on Windows machine using Lahey Fortran . Now, I am compiling with gfortran on ubuntu 64x.
I am getting following error
$ gfortran 3RINGS.FOR
/tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xc10): undefined reference to _mmbsk0_'
/tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xc3d): undefined reference tommbsk1'
/tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xc6a): undefined reference to _mmbsi0_'
/tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xc97): undefined reference tommbsi1'
/tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xcc4): undefined reference to _mmbsk0_'
/tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xcf1): undefined reference tommbsk1'
/tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xd1e): undefined reference to _mmbsi0_'
/tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0xd4b): undefined reference tommbsi1'
/tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0x1182): undefined reference to _mmbsk0_'
/tmp/ccjCDh8B.o:3RINGS.FOR:(.text+0x11a5): undefined reference tommbsi0'
collect2: ld returned 1 exit status
The error is regarding following variable declaration in code
REAL*8 MMBSK0,MMBSK1,MMBSI0,MMBSI1
I will appreciate any suggestion to solve this problem and compile this code.
I will be happy to upload the entire code (263 lines) if anybody need that.
(Unrelated to your problem - note that REAL*8 is an extension to standard Fortran. The correct syntax is REAL(8), where the meaning of "8" depends on your compiler.)
The compiler thinks those MM... names declare functions, rather than variables. It usually deduces that a name references a function based on the way the name is used later in the code.
I'd guess that there's more to your program than the single source file - perhaps other source files that you need to compile and link in with your main program.
Related
When compiling a fortran code, I set
FCL = mpiifort -qmkl=sequential
LLIBS += -L$(MKLROOT)/lib/intel64 -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64
but when compiling code, it always links to libmkl_scalapack_lp64.so, not libmkl_scalapack_lp64.a. Then error appears,
ifort: command line warning #10006: ignoring unknown option '-qmkl=sequential'
mpi.o: In function `m_max_d_':
mpi.f90:(.text+0x4b52): undefined reference to `dcopy_'
umco.o: In function `umco_mp_umco_calc_trafo_':
umco.f90:(.text+0x8c30): undefined reference to `dgetrf_'
umco.f90:(.text+0x8c69): undefined reference to `dgetri_'
umco.f90:(.text+0x8dde): undefined reference to `dgetri_'
umco.f90:(.text+0x9911): undefined reference to `dgeev_'
umco.f90:(.text+0x9aa4): undefined reference to `dgeev_'
mathtools.f90:(.text+0x3d08): undefined reference to `zgesdd_'
In function `w90_utility_mp_utility_zgemm_new_':
utility.F90:(.text+0x3712): undefined reference to `zgemm_'
/home/app/intel/compilers_and_libraries_2020.0.166/linux/mkl/lib/intel64/libmkl_scalapack_lp64.so: undefined reference to `ssteqr_'
/home/app/intel/compilers_and_libraries_2020.0.166/linux/mkl/lib/intel64/libmkl_scalapack_lp64.so: undefined reference to `dlahqr_'
What is the correct way to link these two libraries?
It depends very much on what you are doing and compiler versions, amongst other things. As such you don't provide sufficient detail for us to answer the question. But the recommended way is to use the Intel link line advisor, which will help you find the answer by filling in all the required details into a web form. You can find this at https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.html#gs.tephcr
First time asking a question here so please bear with me if I'm not entirely coherent.
I've been attempting to learn how to use the OpenNI, libfreenect, and SensorKinect libraries to create some code for the kinect. However, the issue I'm running into is that I cannot seem to get the kinect setup properly so that I may actually test code and understand how everything works. The issue that has been the most problematic has been when I try to compile I receive a plethora of undefined reference errors and the compiler quits.
/tmp/ccnXAyOZ.o: In function `main':
KinectDraw.cpp:(.text+0x9a): undefined reference to `xnEnumerationErrorsAllocate'
KinectDraw.cpp:(.text+0xb6): undefined reference to `xnGetStatusString'
KinectDraw.cpp:(.text+0xfa): undefined reference to `xnInitFromXmlFileEx'
KinectDraw.cpp:(.text+0x12a): undefined reference to `xnEnumerationErrorsToString'
KinectDraw.cpp:(.text+0x148): undefined reference to `xnEnumerationErrorsFree'
KinectDraw.cpp:(.text+0x169): undefined reference to `xnGetStatusString'
KinectDraw.cpp:(.text+0x18a): undefined reference to `xnEnumerationErrorsFree'
KinectDraw.cpp:(.text+0x1a4): undefined reference to `xnEnumerationErrorsFree'
KinectDraw.cpp:(.text+0x1bf): undefined reference to `xnFindExistingRefNodeByType'
KinectDraw.cpp:(.text+0x1db): undefined reference to `xnGetStatusString'
KinectDraw.cpp:(.text+0x202): undefined reference to `xnAllocateDepthMetaData'
KinectDraw.cpp:(.text+0x227): undefined reference to `xnWaitOneUpdateAll'
KinectDraw.cpp:(.text+0x243): undefined reference to `xnGetStatusString'
KinectDraw.cpp:(.text+0x273): undefined reference to `xnGetDepthMetaData'
KinectDraw.cpp:(.text+0x2fe): undefined reference to `xnOSWasKeyboardHit'
KinectDraw.cpp:(.text+0x31a): undefined reference to `xnFreeDepthMetaData'
KinectDraw.cpp:(.text+0x329): undefined reference to `xnProductionNodeRelease'
KinectDraw.cpp:(.text+0x338): undefined reference to `xnProductionNodeRelease'
KinectDraw.cpp:(.text+0x347): undefined reference to `xnContextRelease'
/tmp/ccnXAyOZ.o: In function `xn::NodeWrapper::SetHandle(XnInternalNodeData*)':
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x39): undefined reference to `xnGetRefContextFromNodeHandle'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x54): undefined reference to `xnContextUnregisterFromShutdown'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x60): undefined reference to `xnContextRelease'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x6f): undefined reference to `xnProductionNodeRelease'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x82): undefined reference to `xnProductionNodeAddRef'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0x91): undefined reference to `xnGetRefContextFromNodeHandle'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0xb2): undefined reference to `xnContextRegisterForShutdown'
KinectDraw.cpp:(.text._ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData[_ZN2xn11NodeWrapper9SetHandleEP18XnInternalNodeData]+0xc1): undefined reference to `xnContextRelease'
collect2: error: ld returned 1 exit status
The command being that receives the error is g++ KinectDraw.cpp -I /usr/include/ni -I ~/KinectLibs/OpenNI/Include. I have used https://www.kdab.com/setting-up-kinect-for-programming-in-linux-part-1/ to setup the kinect. If anyone has any insight into my issue or even just a good place to start reading to figure it out I would be very appreciative. Thank you for your time and assistance!
UPDATE: Thanks to lxrec's comment, I'm fairly certain that she/he and my initial assumption were correct in that I am not linking the libraries correctly. I haven't found any documentation for Linux implementations of code that include the directories used in compiling so if anyone has insight into this I would be appreciative.
UPDATE: So I've still yet to resolve the issue (I cannot figure out how to compile the code), however thinking that my installation of OpenNI or libfreenect was bad I have resinstalled them. That however did not solve my problem. Thank you to anyone who can provide insight!
UPDATE: Below is the code that I'm having issues compiling. I haven't even tried to add anything into it yet...
#include <XnCppWrapper.h>
#include <XnStatusCodes.h>
#include <XnOS.h>
#include <math.h>
#include <XnOpenNI.h>
#include <iostream>
using namespace xn;
using namespace std;
int main()
{
cout<<"This is a test\n";
return 0;
}
OpenNI source-code should include the libs files (.so files) in its lib directory ($SOURCE_DIR/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10-$YOUR_VERSION/lib). All of these files (for me there 5 files: libnimCodecs.so, libnimMockNodes.so, libnimRecorder.so, libOpenNI.jni.so and libOpenNI.so) are being copied to /usr/lib after you run the install.sh (please follow the OpenNI build/installation instructions)
Your example code needs a -lOpenNI arg to complete the compile process. So you should compile your code like this: g++ your_code.cpp -I/usr/include/ni -lOpenNI
This might already an old question, hopefully your prob are already solved, and this answer can help someone next time.
I am trying to build some code with G++4.8. Operating system is FreeBSD 9.2 64-bit.
These are the errors I get:
/usr/local/lib/gcc48/include/c++/tr1/hashtable_policy.h:384: undefined reference to `std::tr1::__detail::__prime_list'
/usr/local/lib/gcc48/include/c++/bits/stl_list.h:1570: undefined reference to `std::__detail::_List_node_base::_M_unhook()'
/usr/local/lib/gcc48/include/c++/bits/stl_list.h:1562: undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
I read somewhere that those functions are in libstdc++. Reading this I've added that lib at my project, but I still get those errors. I should add libstdg++ instead? Or it's something else? I don't get it.
I've got the same errors when I linked the program using cc instead of gcc because of a misconfiguration of the Makefile program.
I am migrating a project from Qt4.x to 5, I am almost finished but I am getting errors when linking libQxt.
At first I downloaded the libQxt for Qt5 & compiled it with Qt5 then included them in the project, but it didnt solve any of the undefined references, (probably because there are deprecated functions and such) so I downloaded the libQxt for Qt4 and compiled the libraries using Qt4, and it did solve many of the undefined references, but I am still getting two errors, which shouldnt because the functions the errors refer to are in the included libraries.
These are the errors:
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x82b9): undefined reference to `_imp___ZN14QxtMailMessageC1ERK10QByteArray'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaebc): undefined reference to `_imp___ZNK17QxtMailAttachment7rawDataEv'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: ./release\csnmailbox.o: bad reloc address 0x1 in section `.text$_ZN16AttachmentsModelD1Ev[__ZN16AttachmentsModelD1Ev]'
collect2.exe: error: ld returned 1 exit status
And these are the linkings to the libraries:
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtCore.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtDesignerPlugins.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtGui.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtNetwork.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtSql.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtWeb.a" \
If I comment the line that includes the libQxtnetwork (which is the one that the program really uses) there are more errors, so I dont understand why its not detecting those 2 functions. Here are the errors I get when I comment that line:
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x167): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x61c4): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x6227): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x62a7): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x6dac): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x73c9): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x7500): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x82b9): undefined reference to `_imp___ZN14QxtMailMessageC1ERK10QByteArray'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x85dc): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x8814): undefined reference to `_imp___ZN14QxtMailMessage14setExtraHeaderERK7QStringS2_'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x9b61): undefined reference to `_imp___ZNK14QxtMailMessage14hasExtraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x9cad): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaaff): undefined reference to `_imp___ZNK14QxtMailMessage4bodyEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xab40): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xacb6): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaeb0): undefined reference to `_imp___ZNK14QxtMailMessage10attachmentERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaebc): undefined reference to `_imp___ZNK17QxtMailAttachment7rawDataEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaee7): undefined reference to `_imp___ZN17QxtMailAttachmentD1Ev'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xafd2): undefined reference to `_imp___ZN17QxtMailAttachmentD1Ev'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xb695): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: ./release\csnmailbox.o: bad reloc address 0x1 in section `.text$_ZN16AttachmentsModelD1Ev[__ZN16AttachmentsModelD1Ev]'
I hope someone can enlighten me with some knowledge.
Thankyou very much.
EDIT: I managed to 'fix' those errors, I was missing something so simple as
#include <QxtNetwork>
(I didnt write this code, which makes porting harder than it should)
Bad thing is I have very similar errors now:
..\marssies\csnmailbox.cpp: In member function 'void CSNMailBox::onAttachmentDoubleClicked(const QModelIndex&)':
..\marssies\csnmailbox.cpp:183:46: error: 'class QxtMailAttachment' has no member named 'rawData'
_f.write(_m->attachment(_fname.toLatin1()).rawData());
..\marssies\csnmailbox.cpp: In member function 'virtual void MailWorker::run()':
..\marssies\csnmailbox.cpp:491:57: error: no matching function for call to 'QxtMailMessage::QxtMailMessage(QByteArray)'
m_nm.append(__mm = new QxtMailMessage(_m.toLatin1()));
^
I will try to solve these now, at least I got past that point.
EDIT2: I have managed to solve the first error by changing rawData() to mimeData(), it must have been deprecated. I hope the functionality stays the same.
EDIT3: Apparently the last error is just an issue with the constructor:
QxtMailMessage* __mm= new QxtMailMessage(_m.toLatin1());
The constructor accepts either a QxtMailMessage object or qstrings sender, recipient, but I think _m is the message. I will have to ask who wrote the code, because the names of the variables dont help at all.
I can say the question has been solved. Thankyou.
Is anyone using libraw with mingw? I am trying to compile a program and get the following errors:
obj\Release\inc\img\cimg.o:cimg.cpp|| undefined reference to `_imp___ZN6LibRawC1Ej'|
obj\Release\inc\img\cimg.o:cimg.cpp|| undefined reference to `_imp___ZN6LibRaw9open_fileEPKcx'|
obj\Release\inc\img\cimg.o:cimg.cpp|| undefined reference to `_imp___ZN6LibRaw6unpackEv'|
obj\Release\inc\img\cimg.o:cimg.cpp|| undefined reference to `_imp___ZN6LibRaw13dcraw_processEv'|
obj\Release\inc\img\cimg.o:cimg.cpp|| undefined reference to `_imp___ZN6LibRaw20dcraw_make_mem_imageEPi'|
obj\Release\inc\img\cimg.o:cimg.cpp|| undefined reference to `_imp___ZN6LibRaw7recycleEv'|
obj\Release\inc\img\cimg.o:cimg.cpp:(.text$_ZN6LibRawD1Ev[LibRaw::~LibRaw()]+0xf)||undefined reference to `_imp___ZN6LibRaw7recycleEv'|
||=== Build finished: 7 errors, 0 warnings ===|
I added libraw.a to my project. Can't figure the problem out.
Has anyone an idea?
From those symbol names, it looks like you're trying to compile against a DLL version of libraw (hinted at by the _imp___ prefix). Check your libraw header files and make sure that the function names don't have anything like __declspec(dllimport) or __attribute__((dllimport)) in front of them. These are sometimes hidden by a macro definition, so check the header files to see if there's another macro you can define which will cause it not to use that attribute in the function prototypes.