I try to use FMDB Database but I've got an error :
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_FMDatabase", referenced from:
objc-class-ref in MainViewAppDelegate.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 added the src directory except : fmdb.m, libsqlite3.0.dylib to my librairies
and I've imported "FMDatabase.h" in my Appdelegate.h
This issue is caused by FMDB not being able to find the libsqlite3.0.dylib library. Import that into your project clicking on your project at the top of the Project Navigator, clicking on the "Build Phases" tab, and clicking on the plus button to add it under the "Link Binary With Libraries" section.
I could only guess, but i think that you have missed "Add to targets" checkbox while adding files to project. Also you could check this checkbox (if you forget to do it while importing) in the file inspector's target membership's block.
This issue is caused by FMDB not being able to find the liFMDB-IOS.a library. Import that into your project clicking on your project at the top of the Project Navigator, clicking on the "Build Phases" tab, and clicking on the plus button to add it under the "Link Binary With Libraries" section.
Related
The complete summary of the error is as follows:
Info: Internal Builder is used for build
arm-atollic-eabi-gcc -o test.elf main.o stm32f4xx_it.o system_stm32f4xx.o -T../Debug_STM32F401VC_FLASH.ld -specs=nosys.specs -static -Wl,-cref,-u,Reset_Handler -Wl,-Map=test.map -Wl,--defsym=malloc_getpagesize_P=0x80 -Wl,--start-group -lc -lm -Wl,--end-group -specs=nano.specs
c:/program files (x86)/atollic/truestudio for stm32 9.0.1/armtools/bin/../lib/gcc/arm-atollic-eabi/6.3.1/../../../../arm-atollic-eabi/bin/ld.exe: warning: cannot find entry symbol Reset_Handler; defaulting to 08000000
main.o: In function `main':
C:\Users\Deepayan\Atollic\TrueSTUDIO\STM32_workspace_9.0\test\Debug/..\main.c:26: undefined reference to `TM_USART_Init'
C:\Users\Deepayan\Atollic\TrueSTUDIO\STM32_workspace_9.0\test\Debug/..\main.c:29: undefined reference to `TM_USART_Puts'
C:\Users\Deepayan\Atollic\TrueSTUDIO\STM32_workspace_9.0\test\Debug/..\main.c:33: undefined reference to `TM_USART_Getc'
Where should we specify the Reset Handler? Thanks.
Handlers are defined in an assembler startup file, which is generated automatically by STM32CubeIDE or STM32CubeMX. The file is located in a folder called "Startup" at the root of your project. It is named after your MCU, for example startup_stm32f303xe.s, startup_stm32l476rgtx, etc.
The warning "cannot find entry symbol Reset_Handler" means the startup file is either 1. corrupted, 2. missing, or 3. not included in your build. To fix cases 1 and 2, simply re-generate the code from STM32CubeIDE or STM32CubeMX.
Case 3 is more interesting. Upon code generation, STM32CubeIDE and STM32CubeMX sometimes mark the "Startup" folder as "Exclude from build". To make things worse, the folder doesn't have the "excluded" icon, so there's no obvious way to notice it. So you need to right-click the "Startup" folder, go to "C/C++ Build" and uncheck the "Exclude resource from build" checkbox. This issue seems to arise randomly, often with projects copied from other projects.
Handlers are defined in the assembler startup file. For example startup_stm32f303xe.s for the STM32F303xe family of uCs.
Your project is not properly configured and you are missing the important files.
I had the same Issue with reset-handler.
Caused by the toolchain not compiling the startup.s file.
Eclipse toolchain did not include it automatically, because it only takes assembly-files when the file-type is S, not s. So the fix was renaming startup.s to startup.S.
Check that the assembly startup file is located in a folder marked with a blue circle icon with letter C inside. This mark means that this folder is added to project's known source locations and the builder will check these directories for source files to be translated/compiled. To do that, go to project settings -> C/C++ General -> Paths and Symbols; in the tab Source Locations click Add Folder, in the browse dialog showing your project's folders select the folder that contain the source files to be built (both C and assembly). Click OK and apply the new settings. At least it worked for me
When trying to build a simple Hello world program in C and Elcipse, I get the following errors:
make: *** [C.exe] Error 1 C C/C++ Problem
recipe for target 'C.exe' failed makefile /C/Debug line 29 C/C++ Problem
undefined reference to `WinMain' C line 39, external location: C:\cygwin64\usr\src\debug\cygwin-1.7.33-1\winsup\cygwin\lib\libcmain.c C/C++ Problem
I'm using Cygwin. How can I fix this? I am selected the Cygwin toolchain, and I have the PATH set to C:\cygwin64\bin.
The undefined reference means you are missing a library. To set this up right click the project, select Properties -> C/C++ General -> Paths and Symbols -> Libraries and Libraries Paths. Add the appropriate library and build again.
Also look here - gcc-undefined-reference-to and here.
I am faced with the exact same situation as the question raised by Gustavo in the following Link. Also, I have tried all the solutions posted in that link and other tags (such as changing library names from opus.a to libopus.a, change '\' to '/' and so on) but none of these have solved my problem. By opening the properties of the library file, these are the following things displayed:
Path: /demo/opusfile/libopusfile.a
Type: File (Static Library)
Location: U:\data\Jag\eclipse\wrksp\demo\opusfile\libopusfile.a
The error message displayed by Mingw is as follows:
15:56:57 **** Incremental Build of configuration Debug for project demo ****
Info: Internal Builder is used for build
gcc -o demo.exe "src\\demo.o" -lU:/data/Jag/eclipse/wrksp/demo/opusfile/libopusfile.a
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lU:/data/Jag/eclipse/wrksp/demo/opusfile/libopusfile.a
collect2.exe: error: ld returned 1 exit status
collect2.exe: error: ld returned 1 exit status
Could someone please let me know what am I missing ? I am not able to resolve this issue
I think I found the solution, thanks to the answer posted in this Link. So basically to summarize the solution, I had to remove the 'lib' prefix, the '.a' suffix and the library path when I specified the libraries (-l parameters). The library path has to be specified in the -L parameter . This resolved the above problem but led to another hurdle by Mingw:
libopusfile.dll.a: could not read symbols: Archive has no index; run ranlib to add one.
I executed the 'ranlib' command in the command prompt
cmd_path> ranlib libopusfile.dll.a
, as suggested by the compiler, and this solved all my issues!
(I'm on Windows.)
I try to build pysox. Therefore I built libsox (part of SoX). It is said, that pysox needs "libsox.so and libsox.a in your link path." When building libsox I got "libsox.a", "libsox-1.dll", "libsox.dll.a", "libsox.la", "libsox.lai" and many other strange files. When I placed "libsox.a" in my link path, the previously shown error disappeared. But now the build script has an error when it calls mingw32-gcc which says:
C:\Programme\MinGW\bin\mingw32-gcc.exe -shared -s build\temp.win32-2.7\Release\pysox\sox.o build\temp.win32-2.7\Release\pysox\sox.def -LC:\Programme\Python\libs -LC:\Programme\Python\PCbuild -lsox -lpython27 -lmsvcr90 -o build\lib.win32-2.7\pysox\sox.pyd
build\temp.win32-2.7\Release\pysox\sox.o:sox.c:(.text+0x3a96): undefined reference to `sox_get_encodings_info'
build\temp.win32-2.7\Release\pysox\sox.o:sox.c:(.text+0x5035): undefined reference to `sox_get_encodings_info'
build\temp.win32-2.7\Release\pysox\sox.o:sox.c:(.text+0x795d): undefined reference to `bcopy'
build\temp.win32-2.7\Release\pysox\sox.o:sox.c:(.text+0xa8b3): undefined reference to `bcopy'
collect2: ld returned 1 exit status
error: command 'mingw32-gcc' failed with exit status 1
The following attempts didn't work:
Placing "libsox-1.dll" in link path
Renaming it to "libsox.dll"
Renaming it to "libsox.so"
Placing all files generated along with "libsox.a" in link path
Do I really need an "so" file on Windows (how do I get it)? Or what has to be changed?
MinGW uses a static interface library for each dynamic link library (DLL). The libsox.dll.a library is the one you need at link time, i.e. that needs to be copied into the link path. libsox-1.dll is required in the PATH at runtime, but not needed at link time.
You don't need a .so file on Windows platforms. It seems that some symbols are missing from the static library libsox.a, or that a library is missing from the link line. Windows platforms do not allow unresolved symbols in DLLs, contrary to UNIX-like .so platforms. You might have to give the library containing sox_get_encodings_info and friends explicitly on the command line, remembering precedence on the linker line.
(I'm not sure if "flag" is the word I'm looking for, but I'll explain it.)
I am trying to compile a program that uses the GMP big number library. But to be able to compile with GMP, I have to add -lgmp to the end of the command. For example, if I want to compile "program.c", I have to type gcc program.c -lgmp. This is easy from the command line, but I don't see how to do it in Xcode. How can I add the lgmp flag while using Xcode?
Right-click the target in the Xcode Groups and Files list and select Get Info from the contextual menu. In the Build tab, type linker into the search field and then locate the Other Linker Flags item.
Double-click the Other Linker Flags item and add -lgmp.
Maybe this helps:
You can also open the active target's preferences, and click the "General" tab. You can add the library to be linked inside that tab, in the "Linked Libraries" section at the botton.
Taken from http://www.soulstorm-creations.com/PROJECT_SOULSTORM_2_0/programming-articles/installing-portable-libraries-on-os-x.html
You can just open the folder containing libgmp.a on your system (/usr/local/lib/ for a default install), and drag the library out of the folder onto the target that you want it to get linked into. There are several other ways as well, such as the one suggested by Zitrax.