Author Topic: Linking files problem  (Read 113 times)

Offline Ethalides

  • Single posting newcomer
  • *
  • Posts: 2
Linking files problem
« on: November 05, 2018, 07:31:35 pm »
Hello,
I'm trying to link my program to a library and a header (that I wrote). So I tried using project-> add files  and adding my source code and my header files to the project. They seem to be in the project, but when I try to compile, it doesn't work. I'm getting weird errors like "

obj\Debug\Matrice_librairie.o||In function `Z11scalar_multRKSt6vectorIdSaIdEEiid':|
C:\Users\Etudiant\Desktop\Calcul_matriciel\Matrice_librairie.cpp|33|undefined reference to `__gxx_personality_sj0'|
C:\Users\Etudiant\Desktop\Calcul_matriciel\Matrice_librairie.cpp|33|undefined reference to `_Unwind_SjLj_Register'|
C:\Users\Etudiant\Desktop\Calcul_matriciel\Matrice_librairie.cpp|39|undefined reference to `_Unwind_SjLj_Resume'|
C:\Users\Etudiant\Desktop\Calcul_matriciel\Matrice_librairie.cpp|39|undefined reference to `_Unwind_SjLj_Unregister'|

"

I don't understand how to fix it, could anyone help me ?

I hope I was allowed to ask this in here, I wasn't sure the problem is from code::blocks :/

Thanks!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6359
    • My Best Post
Re: Linking files problem
« Reply #1 on: November 05, 2018, 07:38:39 pm »
Hello,
I'm trying to link my program to a library and a header (that I wrote). So I tried using project-> add files  and adding my source code and my header files to the project. They seem to be in the project, but when I try to compile, it doesn't work. I'm getting weird errors like "

obj\Debug\Matrice_librairie.o||In function `Z11scalar_multRKSt6vectorIdSaIdEEiid':|
C:\Users\Etudiant\Desktop\Calcul_matriciel\Matrice_librairie.cpp|33|undefined reference to `__gxx_personality_sj0'|
C:\Users\Etudiant\Desktop\Calcul_matriciel\Matrice_librairie.cpp|33|undefined reference to `_Unwind_SjLj_Register'|
C:\Users\Etudiant\Desktop\Calcul_matriciel\Matrice_librairie.cpp|39|undefined reference to `_Unwind_SjLj_Resume'|
C:\Users\Etudiant\Desktop\Calcul_matriciel\Matrice_librairie.cpp|39|undefined reference to `_Unwind_SjLj_Unregister'|

"

I don't understand how to fix it, could anyone help me ?

I hope I was allowed to ask this in here, I wasn't sure the problem is from code::blocks :/

Thanks!

Compile the program and the library using the same compiler!

Remember to re-build both program and library.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Ethalides

  • Single posting newcomer
  • *
  • Posts: 2
Re: Linking files problem
« Reply #2 on: November 05, 2018, 07:49:19 pm »
Thanks for your reply.
I've checked the settings, and I'm using the same compiler for both (GNU GCC compiler). And when I compile one file at a time, there doesn't seem to be any mistake, but when compiling the project, I'm getting the same error messages...

Online sodev

  • Almost regular
  • **
  • Posts: 175
Re: Linking files problem
« Reply #3 on: November 05, 2018, 09:18:59 pm »
There are hundreds of GNU GCC compiler and most of them are not compatible with each other :P.

Your error message looks pretty much like you are mixing code that is compiled with SJLJ exception handling and DWARF exception handling (or even SEH?). Make sure that you REALLY use the same compiler, at least use the same exception handling model. The MinGW packages usually contain this information in the directory name, also a gcc --version does output that information.