I am trying to compile a code that uses the FFTW libraries. I have installed these and have checked using lipo that they are installed for x86_64 architecture. However when I try to compile I get the following error
mpif90 -r8 -O3 -assume byterecl -u -I/usr/local/mpich2/include -I/usr/local/fftw_215_mpich2/include -L/usr/local/fftw_215_mpich2/lib -I./OBJ/ ./SRC/tt_main.f90 ./OBJ/xx_exter.o ./OBJ/tt_fft.o ./OBJ/tt_force.o ./OBJ/tt_init.o ./OBJ/tt_io.o ./OBJ/tt_les.o ./OBJ/tt_update.o ./OBJ/tt_stat.o ./OBJ/tt_mod.o ./OBJ/xx_mod.o -o turbo -ldfftw -ldrfftw -ldfftw_mpi -ldrfftw_mpi -lm
Undefined symbols for architecture x86_64:
"_rfftwnd_f77_mpi_", referenced from:
_fft3ds_ in tt_fft.o
_ifft3ds_ in tt_fft.o
"_rfftwnd_f77_mpi_create_plan_", referenced from:
_init_fft3d_ in tt_fft.o
"_rfftwnd_f77_mpi_local_sizes_", referenced from:
_init_fft3d_ in tt_fft.o
ld: symbol(s) not found for architecture x86_64
make[1]: *** [turb] Error 1
make: *** [turbo] Error 2
Can anyone help?
Related
MyMac#Macbook Cs50 % make adab
cc adab.c -o adab
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [adab] Error 1
I got this error because my file adab.c was empty, i wrote some simple code and saved the file, then executed "make adab".
MyMac#Macbook Cs50 % make adab
cc adab.c -o adab
MyMac#Macbook Cs50 %
Hope this is helpful for beginners like me :)
Given a very simple fortran (95) function and a very simple c++ call to the program, I should be able to compile the program using:
g++ -c main1.cpp
gfortran -c test.f95
g++ main1.o test.o -o run
However, here I get the following error:
ld: warning: object file (test.o) was built for newer macOS version (11.5) than being linked (11.0)
Undefined symbols for architecture arm64:
"hello_()", referenced from:
_main in main1.o
"__gfortran_st_write", referenced from:
_hello_ in test.o
"__gfortran_st_write_done", referenced from:
_hello_ in test.o
"__gfortran_transfer_character_write", referenced from:
hello in test.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here, adding a -v tag before the -o tag and after the -o tag and the exe run did not solve the problem, as suggested by the error message.
The path:
/usr/local/include
/usr/local/lib
Outputs such an error:
Undefined symbols for architecture x86_64:
"cv::String::deallocate()", referenced from:
cv::String::~String() in main.o
cv::String::operator=(cv::String const&) 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)
How to fix this error?
I am currently working on a project using netcdf-c library. I have installed it using Homebrew. I have written a small script to write a .NC file. I am using a Mac
When I compile it in CLion using make main the following gets outputted:
make main
cc main.c -o main
Undefined symbols for architecture x86_64:
"_nc_close", referenced from:
_main in main-f43ab9.o
"_nc_get_var_int", referenced from:
_main in main-f43ab9.o
"_nc_inq_varid", referenced from:
_main in main-f43ab9.o
"_nc_open", referenced from:
_main in main-f43ab9.o
"_nc_strerror", referenced from:
_main in main-f43ab9.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: *** [main] Error 1
This is the content of my Cmakelists.txt:
cmake_minimum_required(VERSION 3.6)
project(hello)
INCLUDE_DIRECTORIES(/usr/local/include)
LINK_DIRECTORIES(/usr/local/lib)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /usr/local/lib)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} cc -stdlib=lnetcdf -Wall -Werror main.c")
INCLUDE_DIRECTORIES(/usr/local/include)
LINK_DIRECTORIES(/usr/local/lib)
set(SOURCE_FILES main.c)
add_executable(hello ${SOURCE_FILES})
Despite this I am able to execute my code by using the terminal and typing:
cc -lnetcdf main.c
Could someone tell me where the problem is?
Thanks
I got nasm and I want to compile assembly into an executable. I keep getting the error:
ld: warning: ignoring file firststart.asm, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
when I try to compile with gcc. I am using gcc that comes with xcode. What am I doing wrong?