Undefined symbols for architecture i386:
"_OBJC_CLASS_$_Reachability", referenced from:
objc-class-ref in FirstViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've looked over FirstViewController, reachability.h and reachability.m - It's clearly defined! And I've even added SystemConfiguration.Framework, as well as Reachability.m is in the compile list.
Any ideas? I'm losing my mind!
Pic attached.
http://i.imgur.com/uw4Zb.png
Try to remove references to Reachability.h and Reachability.m files from your xCode project. - Make sure it disappears from Compile Sources.
Search you project's folder to make sure you don't have duplicates for Reachability.h and Reachability.m files in it
Command+Shift+K to clean the project;
Add Reachability.h and Reachability.m back to the xCode project;
Hope this will help.
Related
I am following this wiki.osdev tutorial on making a cross-compiler. I am on MACOSX. Everything up to the point of make all-gcc in the build-gcc directory works. The error I get is:
Undefined symbols for architecture arm64: "_host_hooks", referenced from: c_common_no_more_pch() in c-pch.o toplev::main(int, char**) in libbackend.a(toplev.o) gt_pch_save(__sFILE*) in libbackend.a(ggc-common.o) gt_pch_restore(__sFILE*) in libbackend.a(ggc-common.o) ld: symbol(s) not found for architecture arm64
I can't find other people getting this error, any help is appreciated. And I don't know if it's related to my OS i'm using.
I've littered through Stackoverflow trying to get Unity unit test framework (https://www.throwtheswitch.org/unity) linked and built on CMAKE so that I can write unit tests but I keep hitting this same error:
Undefined symbols for architecture x86_64:
"_setUp", referenced from:
_UnityDefaultTestRun in libunity.a(unity.c.o)
"_tearDown", referenced from:
_UnityDefaultTestRun in libunity.a(unity.c.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/test_problem2_59.exe] Error 1
make[1]: *** [tests/CMakeFiles/test_problem2_59.exe.dir/al
I have documented my final attempt here https://github.com/aamarin/computer_systems/tree/dev with the latest commit being the unstable commit. I'm not sure what else I'm missing in computer_systems/tests/CMakeLists.txt to get this working. Just looking for some guidance and maybe an explanation I might be missing from here https://gitlab.com/CLIUtils/modern-cmake/-/blob/master/examples/extended-project/src/CMakeLists.txt. Guidance on better structuring my folder structure is helpful as well.
Just add empty functions named setUp and teadDown. UnityGettingStartedGuide.
I'm rather unused to C, and completely new to compiling bigger projects, and I'm having problems trying to build GNU Archimedes.
I tried the ./configure and make approach, as well as simply executing gcc -lm archimedes.c -o archimedes in the src/ directory, as the documentation suggests. Both give a similar error message:
Undefined symbols for architecture x86_64:
"_MM2", referenced from:
_ParabMEP2D in ccwORAXj.o
_Hole_MEP2D in ccwORAXj.o
"_creation", referenced from:
_EMC in ccwORAXj.o
"_rnd", referenced from:
_MCdevice_config in ccwORAXj.o
_scat in ccwORAXj.o
_EMC in ccwORAXj.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
MM2, rnd, and creation are functions contained in one of many .h files in src/. Every solution to similar sounding problems had issues linking multiple compiled .c files together, but in this case, there's only one .c file.
If it's relevant, the name of the .o file in the error changes with every try.
I've tried building it under macOS (with both clang and gcc, the latter installed via Homebrew) and Fedora Linux, with similar results.
What am I doing wrong? I hope this is the right place to ask, but I have no idea where else to turn. I'm grateful for suggestions.
Thanks in advance and have a good day!
In the folder /archimedes-2.0.1/src/ go through all header files (.h) and change every "inline" to say "static inline".
This fix was found by Alexander Vogt. His original post is linked to below:
https://lists.gnu.org/archive/html/archimedes-discuss/2017-11/msg00000.html
The problem has to do with compatibility issues between older and newer versions of c compilers.
i want to use libTestFlight.a library in my project, i already import it in "Link Binaries With Libraries", also in build phases, i tried to add "Search Path" and "Header Path", i also tried to change the ARCH to Standard architectures (armv7, armv7s), but still no luck, it always give this error:
Undefined symbols for architecture armv7:
"_deflate", referenced from:
__tf_remote_log_compress_data in libTestFlight.a(tf_remote_log_io.o)
"_deflateInit_", referenced from:
__tf_remote_log_compress_data in libTestFlight.a(tf_remote_log_io.o)
"_deflateEnd", referenced from:
__tf_remote_log_compress_data in libTestFlight.a(tf_remote_log_io.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Add the libz.dylib as the Link Binary With Libraries.
Build Phases > Link Binary With Libraries > push the + button > search the libz.dylib and select it > push the Add button.
My code is identical to this question I asked earlier so there's no point in duplicating it here
This is the error I am getting:
Undefined symbols for architecture x86_64:
"_stdscr", referenced from:
_screen_init in screen.o
"_werase", referenced from:
_screen_init in screen.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've had this error in the past and I feel like it has something to do with a duplicate function name or something, but I have no idea how to debug this.
EDIT:
After adding the libncurses.dylib file to my project, the errors discussed above have disappeared, but a new error has emerged when I call screen_init(); in my main.cpp:
// main.cpp
#include "screen.h"
int main(){
screen_init();
}
// new error
Undefined symbols for architecture x86_64:
"screen_init()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Pretty much the same error except now in my main. Is there another library I am missing? These errors are very mysterious and not very helpful.
I guess you need to add the library to your link phase, if you are going with XCode you should add it in project details:
choose project details
choose build phases tab
open link binary with libraries part
click the plus symbol
add libncurses.dylib to your project.