anderkve / FYS3150

https://anderkve.github.io/FYS3150
27 stars 14 forks source link

Another linking error #56

Closed JohanCarlsen closed 2 years ago

JohanCarlsen commented 2 years ago

Hi! I am trying to create the classes, but when i test out compiling and linking, I get an error message

Undefined symbols for architecture x86_64 symbol(s) not found for architecture x86_64

Link to repo: https://github.com/Madssb/FYS3150_H22_4_pers/tree/johan/Project_3

anderkve commented 2 years ago

Hi @JohanCarlsen!

What are the exact compilation and linking command(s) you use?

anderkve commented 2 years ago

And was there more info in the error message? I.e. were there some specific symbol names mentioned?

JohanCarlsen commented 2 years ago

g++ main.cpp src/particle.cpp -std=c++11 -I include -o main.exe Undefined symbols for architecture x86_64: "thread-local wrapper routine for arma::mt19937_64_instance", referenced from: arma::(anonymous namespace)::mt19937_64_instance_warmup::mt19937_64_instance_warmup() in main-73a770.o arma::(anonymous namespace)::mt19937_64_instance_warmup::mt19937_64_instance_warmup() in particle-08d362.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

JohanCarlsen commented 2 years ago

It's really hard to understand any of this, but it seems armadillo is complaining..

JohanCarlsen commented 2 years ago

Oh s**t, I forgot the -larmadillo

JohanCarlsen commented 2 years ago

LOL, now it worked. Haha!

anderkve commented 2 years ago

Oh s**t, I forgot the -larmadillo

Indeed :D

Happy to hear it's working now!

JohanCarlsen commented 2 years ago

Reminds me of the lecture where the lady talking about report writing. She mentioned that talking about your problem often makes it more clear! =)

anderkve commented 2 years ago

I know -- the same keeps happening to me all the time :)

Btw, if you're curious about the actual missing symbol, it was probably related to the fact that you call some random number generator via Armadillo. At least the "mt19937" name should refer to the Mersenne Twister algorithm for generating random numbers. (More on that later in the course.)