I am trying to make .lib file of ARPACK library to use with VS2012 Express Edition. Hence I am using the command in MSYS as :
dllwrap --export-all-symbols BLAS/.o LAPACK/.o SRC/.o UTIL/.o
-lgfortran --output-def arpack_win32.def -o arpack_win32.dll
This results in error:
real_write' UTIL/smout.o:smout.f:(.text+0x12cf): undefined reference
to _gfortran_transfer_ array_write'
UTIL/smout.o:smout.f:(.text+0x12f1): undefined reference to
_gfortran_transfer_ integer_write'
UTIL/smout.o:smout.f:(.text+0x13b4): undefined reference to
_gfortran_transfer_ integer_write'
UTIL/smout.o:smout.f:(.text+0x13ef): undefined reference to
_gfortran_transfer_ real_write' UTIL/smout.o:smout.f:(.text+0x1581):
undefined reference to _gfortran_transfer_ array_write'
UTIL/smout.o:smout.f:(.text+0x15a3): undefined reference to
_gfortran_transfer_ integer_write'
UTIL/smout.o:smout.f:(.text+0x1666): undefined reference to
_gfortran_transfer_ integer_write'
UTIL/smout.o:smout.f:(.text+0x16a1): undefined reference to
_gfortran_transfer_ real_write' UTIL/svout.o:svout.f:(.text+0xb4):
undefined reference to _gfortran_transfer_ch aracter_write'
UTIL/svout.o:svout.f:(.text+0xd2): undefined reference to
_gfortran_transfer_ch aracter_write'
UTIL/svout.o:svout.f:(.text+0x1b5): undefined reference to
_gfortran_transfer_i nteger_write'
UTIL/svout.o:svout.f:(.text+0x1cd): undefined reference to
_gfortran_transfer_i nteger_write'
Cant figure it out why this happens....Thanks..
Finally figured out what was wrong....I was using MinGW with gfortran..... Adding C:\MinGW\bin to PATH solved all the issues.....
Related
This question already has answers here:
How to add "-l" (ell) compiler flag in CMake
(2 answers)
Closed 3 years ago.
I am trying to use curl inside c++ code. How should i do it properly ?
I have pasted libcurl.a & libcurl.dll.a in this directory:
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\lib
This is my CMakeLists.txt from CLion/Mingw
cmake_minimum_required(VERSION 3.3)
project(tan)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -lcurl.dll")
add_executable(tan Tan/mail.cpp)
project(untitled6)
When I add "#define CURL_STATICLIB" i get these errors:
reference to `curl_easy_init'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:84: undefined
reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:86: undefined reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:91: undefined reference to `curl_slist_append'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:92: undefined reference to `curl_slist_append'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:93: undefined reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:98: undefined reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:99: undefined reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:100: undefined reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:103: undefined reference to `curl_easy_perform'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:107: undefined reference to `curl_easy_strerror'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:111: undefined reference to `curl_slist_free_all'
C:/Users/John/CLionProjects/tan/Tam/mail.cpp:121: undefined reference to ````curl_easy_cleanup
Without "#define CURL_STATICLIB" i get these errors:
CMakeFiles\tan.dir/objects.a(mail.cpp.obj): In function `main':
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:81: undefined reference to `__imp_curl_easy_init'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:84: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:86: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:91: undefined reference to `__imp_curl_slist_append'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:92: undefined reference to `__imp_curl_slist_append'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:93: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:98: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:99: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:100: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:103: undefined reference to `__imp_curl_easy_perform'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:107: undefined reference to `__imp_curl_easy_strerror'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:111: undefined reference to `__imp_curl_slist_free_all'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:121: undefined reference to `__imp_curl_easy_cleanup'
If anybody comes looking use this in CMakeLists.txt. The last line solved the issue.
Step1:
Copy libcurl.dll.a in C:/curl.
No need to copy "libcurl.a" OR "libcurl.dll.a" at any other place.
No need for #define CURL_STATICLIB in main.cpp file
Step2: Edit the CMakeLists.txt as below.
set(CMAKE_CXX_STANDARD 14)
add_executable(tan Tan/mail.cpp)
project(untitled6)
target_link_libraries(tan "C:/curl/libcurl.dll.a")
Step3: If your program flashes quickly and closes. You might be missing some dll files. To check which ones you are missing , run the program (in my case tan.exe) with cmd. Take that dll from curl package (in my case curl-7.65.0-win64-mingw) and put it along side of your executable file. Make sure curl and your executable is compiled with same compiler. In my case it's Mingw.
my platform configure is:
win10 64bits
QT5.8 32位(QT Creator 4.21 + MinGW5.30 32bits + Cmake 3.81 64bits)
Cmake configured as this blog
and I am in trouble that:
../../3rdparty/lib/liblibprotobuf.a(strtod.cc.obj): In function `strtod':
D:/Qt/Qt5.8.0/Tools/mingw530_32/i686-w64-mingw32/include/stdlib.h:399: undefined reference to `__mingw_strtod'
D:/Qt/Qt5.8.0/Tools/mingw530_32/i686-w64-mingw32/include/stdlib.h:399: undefined reference to `__mingw_strtod'
../../3rdparty/lib/libzlib.a(gzlib.c.obj): In function `snprintf':
D:/Qt/Qt5.8.0/Tools/mingw530_32/i686-w64-mingw32/include/stdio.h:557: undefined reference to `__ms_vsnprintf'
../../3rdparty/lib/libzlib.a(gzwrite.c.obj): In function `vsnprintf':
D:/Qt/Qt5.8.0/Tools/mingw530_32/i686-w64-mingw32/include/stdio.h:545: undefined reference to `__ms_vsnprintf'
../../3rdparty/lib/liblibpng.a(pngwrite.c.obj): In function `gmtime':
D:/Qt/Qt5.8.0/Tools/mingw530_32/i686-w64-mingw32/include/time.h:219: undefined reference to `_gmtime32'
../../3rdparty/lib/liblibjasper.a(jas_stream.c.obj): In function `vsnprintf':
D:/Qt/Qt5.8.0/Tools/mingw530_32/i686-w64-mingw32/include/stdio.h:545: undefined reference to `__ms_vsnprintf'
I can not solve undefined reference to __mingw_vfscanf and undefined reference to __ms_vsnprintfproblem. someone say it should be too chain problem,but my tool chain is builted in QT except cmake.
I am trying to link to my project some static libraries compiled with gcc-5.
In my project i use clang to build. I have following errors:
undefined reference to 'stderr'
undefined reference to '__fprintf_chk'
undefined reference to '__vfprintf_chk'
Trying to compile a third party library on MinGW in Code::Blocks on Lubuntu, and despite my absolute best efforts to eliminate the following undefined references which I've spent ages on, nothing is fixing the issues:
undefined reference to `_sfwgl_ext_EXT_swap_control
undefined reference to `_sfwgl_ext_ARB_pixel_format
undefined reference to `_sf_ptrc_wglChoosePixelFormatARB
undefined reference to `_sf_ptrc_wglGetPixelFormatAttribivARB
undefined reference to `_sfwgl_ext_ARB_multisample
undefined reference to `_sf_ptrc_wglGetPixelFormatAttribivARB
undefined reference to `_sfwgl_ext_ARB_pixel_format
undefined reference to `_sfwgl_ext_ARB_create_context
undefined reference to `_sfwgl_ext_ARB_create_context_profile
undefined reference to `_sf_ptrc_wglCreateContextAttribsARB
undefined reference to `_sf_ptrc_wglCreateContextAttribsARB
undefined reference to `_sf_ptrc_wglGetPixelFormatAttribivARB
undefined reference to `_sfwgl_ext_ARB_multisample
undefined reference to `_sf_ptrc_wglGetPixelFormatAttribivARB
undefined reference to `_sfwgl_LoadFunctions
From what I can tell is it's possibly some sort of missing GL library or graphics library, however I already have opengl32, gdi32, glu32, glut32 and gle added to the link library which has left the following undefined references untouched.
How do I fix the above errors?
[If it is a missing library or libraries, could I be linked to the download page for the appropriate headers and .a files for MinGW on linux? Thanks.]
I've been trying to compile this OpenGL tutorial (originally purposed for Visual Studio) but I keep having 'undefined reference' errors. The compiler output is as follows:
Info: Internal Builder is used for build
g++ -o OpenGLTutorial.exe "src\\main.o" "src\\Camera.o" -lglew32 -lglu32 -lopengl32 -lfreeglut
src\main.o: In function `Z6InitGLiPPc':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:75: undefined reference to `glutInit'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:76: undefined reference to `glutSetOption'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:77: undefined reference to `glutGet'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:78: undefined reference to `glutGet'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:80: undefined reference to `glutInitDisplayMode'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:82: undefined reference to `glutInitContextVersion'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:83: undefined reference to `glutInitContextProfile'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:84: undefined reference to `glutInitContextFlags'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:86: undefined reference to `glutInitWindowPosition'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:87: undefined reference to `glutInitWindowSize'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:89: undefined reference to `glutCreateWindow'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:91: undefined reference to `glutIdleFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:92: undefined reference to `glutDisplayFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:93: undefined reference to `glutKeyboardFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:94: undefined reference to `glutKeyboardUpFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:95: undefined reference to `glutSpecialFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:96: undefined reference to `glutSpecialUpFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:97: undefined reference to `glutMouseFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:98: undefined reference to `glutMotionFunc'
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:99: undefined reference to `glutReshapeFunc'
src\main.o: In function `main':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:236: undefined reference to `glutMainLoop'
src\main.o: In function `Z9ReshapeGLii':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:249: undefined reference to `glutPostRedisplay'
src\main.o: In function `Z9DisplayGLv':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:262: undefined reference to `glutSwapBuffers'
src\main.o: In function `Z6IdleGLv':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:278: undefined reference to `glutPostRedisplay'
src\main.o: In function `Z10KeyboardGLhii':
C:\Users\jordanrich\Documents\programming\C++\GameDev\OpenGLTutorial\Debug/../src/main.cpp:313: undefined reference to `glutLeaveMainLoop'
collect2.exe: error: ld returned 1 exit status
21:39:05 Build Finished (took 1s.154ms)
Can anyone tell me what is wrong?
If you need any more information to help answer the question just ask.
Edit (Some additional info):
As you can see from the compiler output I have linked the library that these functions require and the compiler does not complain that it could not find said library. Also I placed the freeglut dll into the binary folder.
This problem was apparently mainly due to user error and was completely circumstantial. I'm posting this for the people of the future who might have this problem.
In my header file I defined FREEGLUT_STATIC. After changing this to another variable, the linker no longer produced errors. Though I can't actually check -- very easily at least -- somewhere in my freeglut library this variable was used in an ifndef statement to determine whether freeglut needed to be linked (in case it was already linked).