Undefined symbols for architecture i386: "_AudioServicesCreateSystemSoundID" - xcode

I am trying to make a soundboard app and i get this error
Undefined symbols for architecture i386:
"_AudioServicesCreateSystemSoundID", referenced from:
-[S0undFXViewController sound1] in S0undFXViewController.o
-[S0undFXViewController sound2] in S0undFXViewController.o
-[S0undFXViewController sound3] in S0undFXViewController.o
-[S0undFXViewController sound4] in S0undFXViewController.o
-[S0undFXViewController sound5] in S0undFXViewController.o
-[S0undFXViewController sound6] in S0undFXViewController.o
I DONT GET IT!!!!!!!

That sort of error is usually caused by a missing framework.
Have you added the AudioServices framework to your project? It isn't enough to just import the header files.
Edit
Actually, if you turn on module support in Xcode, it is enough to just #import the Framework.

Related

How can I do to when the erorr show the pic?

When I build project
This erorr show[ undefined reference to `virtual thunk to veins::TraCIScenarioManagerLaunchd::finish()]

MediaPipe library build on macOS

I'm trying to build MediaPipe as library on macOS to be able to use it in a
desktop project with CMake, but I'm running into issues. I'm trying to convert
the Hello World example to a library, using hello_world.cc with MediaPipe as
an external lib. I tried static and dynamic library build as well, but I have
encountered issues with both of them.
At the moment I'm stuck and any help would be greatly appreciated.
The steps of building the libraries and the received errors are below:
As a static library
I created a file mediapipe/lib/BUILD with the following content
apple_static_library(
name = "mediapipe",
minimum_os_version = "10.14",
platform_type = "macos",
deps = [
"//mediapipe/calculators/core:pass_through_calculator",
"//mediapipe/framework:calculator_graph",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:parse_text_proto",
"//mediapipe/framework/port:status",
],
)
Built the lib
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/lib:mediapipe
Copied bazel-out/apl-darwin_x86_64-opt/bin/mediapipe/lib/mediapipe_lipo.a to my desktop project
The project has been built without errors, but it gives the following errors when ran:
Not found: ValidatedGraphConfig Initialization failed.
No registered object with name: PassThroughCalculator; Unable to find Calculator "PassThroughCalculator"
No registered object with name: PassThroughCalculator; Unable to find Calculator "PassThroughCalculator"
As a dynamic library
I read some github issues that building an iOS dynamic library does not exhibit the problems above.
Bazel build file mediapipe/dylib/BUILD with the following content
load("#build_bazel_rules_apple//apple:macos.bzl", "macos_dylib")
macos_dylib(
name = "mediapipe",
minimum_os_version = "10.15",
deps = [
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework/port:commandlineflags",
"//mediapipe/framework/port:file_helpers",
"//mediapipe/framework/port:map_util",
"//mediapipe/framework/port:parse_text_proto",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status",
"//mediapipe/framework/port:statusor",
"#com_google_absl//absl/strings",
#"//mediapipe/graphs/hand_tracking:desktop_tflite_calculators",
"//mediapipe/calculators/core:pass_through_calculator",
],
)
Built the dylib
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/dylib:mediapipe
Fixed the dylib id
chmod 755 mediapipe.dylib
install_name_tool -id mediapipe.dylib mediapipe.dylib
Copied bazel-bin/mediapipe/dylib/mediapipe.dylib to my project
During build I get linking errors:
Undefined symbols for architecture x86_64:
"mediapipe::CalculatorGraph::Initialize(mediapipe::CalculatorGraphConfig const&)", referenced from:
mediapipe::PrintHelloWorld() in MediaPipeApp.cpp.o
MediaPipeApp::setup() in MediaPipeApp.cpp.o
"mediapipe::CalculatorGraph::WaitUntilDone()", referenced from:
mediapipe::PrintHelloWorld() in MediaPipeApp.cpp.o
"mediapipe::CalculatorGraph::CloseInputStream(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
mediapipe::PrintHelloWorld() in MediaPipeApp.cpp.o
"mediapipe::CalculatorGraph::AddOutputStreamPoller(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
mediapipe::PrintHelloWorld() in MediaPipeApp.cpp.o
"mediapipe::CalculatorGraph::AddPacketToInputStream(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, mediapipe::Packet&&)", referenced from:
mediapipe::PrintHelloWorld() in MediaPipeApp.cpp.o
"mediapipe::CalculatorGraph::StartRun(std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, mediapipe::Packet, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, mediapipe::Packet> > > const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, mediapipe::Packet, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, mediapipe::Packet> > > const&)", referenced from:
mediapipe::PrintHelloWorld() in MediaPipeApp.cpp.o
"mediapipe::CalculatorGraph::CalculatorGraph()", referenced from:
mediapipe::PrintHelloWorld() in MediaPipeApp.cpp.o
MediaPipeApp::setup() in MediaPipeApp.cpp.o
"mediapipe::CalculatorGraph::~CalculatorGraph()", referenced from:
mediapipe::PrintHelloWorld() in MediaPipeApp.cpp.o
MediaPipeApp::setup() in MediaPipeApp.cpp.o
"mediapipe::internal::OutputStreamPollerImpl::Next(mediapipe::Packet*)", referenced from:
mediapipe::PrintHelloWorld() in MediaPipeApp.cpp.o
ld: symbol(s) not found for architecture x86_64
Try using xcode 11 beta 4 or higher.
Apple moved swift libraries into "swift-5.0" directory, hence tulsi fails to build.
A workaround would be soft-linking the libraries from "swift-5.0" to the "swift" directory and then re-run the build process.
refer to https://forums.developer.apple.com/thread/120074.

Undefined symbols for architecture armv7 in Xcode 7.1

I'm making a game with Vuforia and an Unity plugin called Mobile Movie Textures. When I try to build my Xcode project it all goes well until it starts linking. I get a bunch of errors all from the same library saying that it doesn't recognize symbols.
Undefined symbols for architecture armv7:
"_oc_idct8x8_arm", referenced from:
_oc_state_frag_recon_arm in libtheorawrapper.a(armstate.o)
_oc_state_accel_init_arm in libtheorawrapper.a(armstate.o)
"_oc_idct8x8_1_arm", referenced from:
_oc_state_frag_recon_arm in libtheorawrapper.a(armstate.o)
"_oc_frag_recon_intra_arm", referenced from:
_oc_state_frag_recon_arm in libtheorawrapper.a(armstate.o)
_oc_state_accel_init_arm in libtheorawrapper.a(armstate.o)
"_oc_pack_read1_arm", referenced from:
_th_decode_packetin in libtheorawrapper.a(decode.o)
_oc_huff_tree_unpack in libtheorawrapper.a(huffdec.o)
_oc_quant_params_unpack in libtheorawrapper.a(dequant.o)
"_oc_frag_recon_inter2_arm", referenced from:
_oc_state_frag_recon_arm in libtheorawrapper.a(armstate.o)
_oc_state_accel_init_arm in libtheorawrapper.a(armstate.o)
"_oc_frag_copy_list_arm", referenced from:
_oc_state_accel_init_arm in libtheorawrapper.a(armstate.o)
"_oc_frag_recon_inter_arm", referenced from:
_oc_state_frag_recon_arm in libtheorawrapper.a(armstate.o)
_oc_state_accel_init_arm in libtheorawrapper.a(armstate.o)
"_oc_loop_filter_frag_rows_arm", referenced from:
_oc_state_accel_init_arm in libtheorawrapper.a(armstate.o)
"_oc_huff_token_decode_arm", referenced from:
_th_decode_packetin in libtheorawrapper.a(decode.o)
_oc_sb_run_unpack in libtheorawrapper.a(decode.o)
"_oc_pack_read_arm", referenced from:
_th_decode_packetin in libtheorawrapper.a(decode.o)
_oc_sb_run_unpack in libtheorawrapper.a(decode.o)
_th_decode_headerin in libtheorawrapper.a(decinfo.o)
_oc_unpack_length in libtheorawrapper.a(decinfo.o)
_oc_huff_tree_unpack in libtheorawrapper.a(huffdec.o)
_oc_quant_params_unpack in libtheorawrapper.a(dequant.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I could just make the devices with an armv7 arch incompatible but they make up 55% of the dutch market.
I don't know how to fix this, can any of you figure it out?
The library libtheorawrapper.a in the current version of the plugin is broken and does not contains all of the needed symbols.
If you want to use the plugin you will have to recompile the library.
To do that you need to checkout this repository
.
Then edit this file:
MMTPlugin/build/XCode/theorawrapper.xcodeproj/project.pbxproj
an replace on line 134 and 144
/Users/dan/Documents/MobileMovieTexture/
with the path you cloned the repo (eg.):
/Users/MyUser/Code/git/MobileMovieTexture
You can then open that project with XCode and recompile the library.
The resulting file will be placed at:
MMTUnity/Assets/Plugins/iOS/libtheorawrapper.a
you should copy that file to your unity plugin folder:
Assets/Plugins/iOS/libtheorawrapper.a
I got the same issue this morning, it's a problem with the latest version of the MMT plugin: basically, the Assets/Plugins/iOS/libtheorawrapper.a file does not contain everything it should for the armv7 architecture. I replaced it with the same file from the previous version of the plugin (which, fortunately, I had in another project), and everything builds and links again.
As a side note, that file went from about 300KB before to 1.8MB in the latest version, this too seems kind of wrong to me.
I'm about to email the developer about those problems, but feel free to do it too.
I just had this problem today and it seems that more people do as well.
I succeeded in fixing the library file so that it now works. Just replace it with the one in the Unity/plugins/ios folder
here is a link to download it: https://www.dropbox.com/s/kp8u9ggzw6xxvit/libtheorawrapper.a?dl=0

getting nafxcwd.lib(timecore.obj) error lnk2001 unresolved external symbol __mbctype after header-include from other project

I made a new project for unittesting with googleTest. I then added a source file from another project to test it. I then got severeal linker errors:
nafxcwd.lib(timecore.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(apphelp.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(filelist.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
The key options in my projects are:
Testproject:
Runtime Library: Multithreaded Debug DLL (necessary for googleTest)
Use of MFC: Shared DLL
productive project: (this should actually not matter)
Runtime Library: Multithreaded Debug DLL
Use of MFC: Use MFC in a static library
Even if I copy all the options and files from the productive project with MFC as shared DLL these messages get thrown.
The file, that was imported to the testproject had the "stdafx.h"-include that was resolved to the productive projects one.
There,
#include <afxwin.h>
was included. Checking that one turned out, that for shared MFC-DLL, you need to
#define _AFXDLL
in your project / before the afxwin-include. Otherwise you get these errors.

linking to a static 0MQ library in VS

This may be a Visual Studio question more than anything else...
I'm trying to build a 0MQ C++ example using VS10 and ZeroMQ 2.2.0.
I downloaded the windows sources and tried to follow these instructions in order to build 0MQ statically. Specifically:
Switched to Release
For all 7 projects in the solution:
set General\Configuration Type to Static library (.lib)
set C/C++\Code Generation\Runtime Library to Multi-threaded (/MT)
added ZMQ_STATIC to C/C++\Preprocessor\Preprocessor Definitions
Updated zmq.h and zmq_utils.h so that if _MSC_VER and ZMQ_STATIC are defined then DLL_EXPORT will also be defined
At this point 0MQ seems to build well.
Created an empty console project:
switched to Release
added a single cpp file with the example linked above
changed random to rand, srandom to srand and snprintf to _snprintf
set C/C++\Code Generation\Runtime Library to Multi-threaded (/MT)
added ...\zeromq-2.2.0\include folder to C/C++\General\Additional Include Directories
added ...\zeromq-2.2.0\builds\msvc\Release\*.lib to Linker\Input\Additional Dependencies
However I still receive the following linking errors:
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_bind
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_close
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_errno
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_init
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_msg_data
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_strerror
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_socket
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_msg_init_size
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_term
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_msg_close
1>zmqexp.obj : error LNK2001: unresolved external symbol __imp__zmq_send
What have I missed?
You should add ZMQ_STATIC to C/C++\Preprocessor\Preprocessor Definitions in your "empty console project" too. Otherwise, when you compile your application, ZMQ_EXPORT in zmq.h is defined as __declspec(dllimport), and as a result, MSVC looks for __imp__zmq_* symbols instead of zmq_*
I had similar errors - not when trying to statically link, but just trying to create a ZMQ project and link the .lib 'stubs' for the dll.
In my case it was because I was trying to link the 64-bit libraries into a 32-bit project. I had downloaded the wrong version. When I got the right ones, ie x86 instead of x64, it worked.
Is the static linking very important to you? If not, you can try out the second answer by elnino_9 here. Elaborating elnino_9's answer:
Download the sources and unzip to some local folder (say C:\dev\zeromq).
Go to C:\dev\zeromq-2.2.0\builds\msvc and open the msvc.sln solution. MS2010 will upgrade from a VS2008 to a VS2010 project
Build all of the projects.
The build should generate the two following files:
C:\dev\zeromq\lib\libzmq.lib - this is what you will need to reference in your project's linker options
C:\dev\zeromq_boaz\builds\msvc\Release\libzmq.dll - this you will need to copy to the same folder as your project's executable in order to run it (if your build was configured to 'Debug', the path would be C:\dev\zeromq\builds\msvc\ Debug \libzmq.dll)
Create your solution and project. Do the following:
In the Solution Explorer, right-click on you project, and select 'Properties' (at the very bottom).
Navigate to 'C/C++ --> General --> Additional Include Directories' and add C:\dev\zeromq\include. This will reference 0MQ's header files.
Navigate to 'Linker --> Input --> Additional Dependencies' and add the full path to the 'libzmq.dll' file from the previous step.
Build your project - this should go without errors now.
Copy 'libzmq.dll' to the same folder as your executable - your project should now run.
Some comments:
I am not sure why you need to reference the 'libzmq.lib' file. It is not needed by the executable (you can delete it, and it will still run, as the necessary logic resides in the dll). Can someone explain this?
Notice one caveat in the example for Windows users - the second binding statement (publisher.bind("ipc://weather.ipc");) will cause an exception. As explained here (though in fine-print), the Inter-Process Transport is not supported on Windows.
EDIT
I think the answer to my first comment can be found in MSDN:
"When the source code for the calling executable is compiled or assembled, the DLL function call generates an external function reference in the object code. To resolve this external reference, the application must link with the import library (.lib file) provided by the maker of the DLL."

Resources