Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to build my program and have been getting errors that I don't know how to resolve.

The errors are undefined reference to '__security_init_cookie' and undefined reference to '__mingw_init_ehandler'. I suspect it's something to do with linking but I am unsure how to solve this, I found no real resolutions on google.

My compilation args are below with the relevant error:

Compilation:

g++ -Wl,-subsystem,windows -mthreads -o debugWAMsoft.exe 
@object_script.WAMsoft.Debug  -LC:oost_1_75_0oost -LC:cygwin64usrx86_64-
w64-mingw32sys-rootmingwlib -Lusrinclude -Xlinker --verbose -w -lgmp -lm -
LC:UsersChrisFuscoDocumentsQTqt5-buildqtbaselib 
C:UsersChrisFuscoDocumentsQTqt5-buildqtbaseliblibQt5Widgetsd.a 
C:UsersChrisFuscoDocumentsQTqt5-buildqtbaseliblibQt5Guid.a 
C:UsersChrisFuscoDocumentsQTqt5-buildqtbaseliblibQt5Xmld.a 
C:UsersChrisFuscoDocumentsQTqt5-buildqtbaseliblibQt5XmlPatternsd.a 
C:UsersChrisFuscoDocumentsQTqt5-buildqtbaseliblibQt5Networkd.a 
C:UsersChrisFuscoDocumentsQTqt5-buildqtbaseliblibQt5Cored.a  "C:Program 
Filesmingw-w64x86_64-8.1.0-posix-seh-rt_v6-rev0mingw64x86_64-w64-
mingw32liblibglu32.a" "C:Program Filesmingw-w64x86_64-8.1.0-posix-seh-rt_v6-
rev0mingw64x86_64-w64-mingw32liblibopengl32.a" "C:Program Filesmingw-
w64x86_64-8.1.0-posix-seh-rt_v6-rev0mingw64x86_64-w64-mingw32liblibgdi32.a" 
"C:Program Filesmingw-w64x86_64-8.1.0-posix-seh-rt_v6-rev0mingw64x86_64-w64-
mingw32liblibuser32.a" -lmingw32 C:UsersChrisFuscoDocumentsQTqt5-
buildqtbaseliblibqtmaind.a -lshell32

Full Error:

attempt to open C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o succeeded
C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtend.o
C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o:crtexe.c:(.text+0x264): undefined reference to `__mingw_init_ehandler'      
C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o:crtexe.c:(.text+0x4c2): undefined reference to `__security_init_cookie'     
C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o:crtexe.c:(.text+0x4f2): undefined reference to `__security_init_cookie'     
collect2.exe: error: ld returned 1 exit status

Any help is very much appreciated; I've been at this for days and I just want to move on to coding!

question from:https://stackoverflow.com/questions/65932813/reference-error-when-attempting-to-build-link-project-with-mingw-w64

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
629 views
Welcome To Ask or Share your Answers For Others

1 Answer

Similar problems has happened to me before. When the following message shows, the problem usually would be the static library is not found

undefined reference to ....

My suggestion would be why not move your static libraries ".a" into the folder

/x86_64-w64-mingw32/lib/

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...