Dear Rodrigo,
You seem to have mistyped the compile command that Dennis gave you. It requires a "-o" before the final "calc".
You typed:
gcc -Wall calc.c -lm calc
You need to type:
gcc -Wall calc.c -lm -o calc
Otherwise gcc will assume that "calc" is file to be compiled, not the desired output filename.
Toby
On 29 Mar 2012, at 01:29, Rodrigo Perea wrote:
> I know, there is something wrong with the compiler but I dont know how to fix it :/
> Here is what I got:
>
> ###################################
> ~/Desktop$ gcc -Wall calc.c -lm calc
> i686-apple-darwin11-llvm-gcc-4.2: calc: No such file or directory
>
>
> ###################################
>
>
> >>> Dennis Thompson <[log in to unmask]> 3/28/2012 06:53 PM >>>
> You have a problem with the compiler not being able to find the
> standard headers. To verify try this. Put the following code in a
> text file "calc.c"
>
> #############################
>
> #include <math.h>
> #include <stdio.h>
>
> int
> main (void)
> {
> double x = sqrt (2.0);
> printf ("The square root of 2.0 is %f\n", x);
> return 0;
> }
>
> #####################################
>
> Compile with the command
> "gcc -Wall calc.c -lm -o calc"
>
> If gcc is installed correctly this should compile and run without any errors.
>
> Running calc should produce
>
> ./calc
> The square root of 2.0 is 1.414214
>
> If this does not work then your INCLUDE_PATH is messed up. And I
> would suggest looking into re-installing your gcc
>
>
> Dennis
>
>
> On Wed, Mar 28, 2012 at 3:06 PM, Rodrigo Perea <[log in to unmask]> wrote:
> > After Section 3 in the website provided:
> >
> >>> mex -setup
> >
> >
> > Options files control which compiler to use, the compiler and link
> > command
> >
> > options, and the runtime libraries to link against.
> >
> >
> > Using the 'mex -setup' command selects an options file that is
> >
> > placed in /Users/rperea/.matlab/R2012a and used by default for 'mex'. An
> > options
> >
> > file in the current working directory or specified on the command line
> >
> > overrides the default options file in /Users/rperea/.matlab/R2012a.
> >
> >
> >
> > To override the default options file, use the 'mex -f' command
> >
> > (see 'mex -help' for more information).
> >
> >
> > The options files available for mex are:
> >
> >
> > 1: /Applications/MATLAB_R2012a.app/bin/mexopts.sh :
> >
> > Template Options file for building gcc MEX-files
> >
> >
> >
> >
> > 0: Exit with no changes
> >
> >
> > Enter the number of the compiler (0-1):
> >
> > 1
> >
> >
> > Overwrite /Users/rperea/.matlab/R2012a/mexopts.sh ([y]/n)?
> >
> > y
> >
> >
> > /Applications/MATLAB_R2012a.app/bin/mexopts.sh is being copied to
> >
> > /Users/rperea/.matlab/R2012a/mexopts.sh
> >
> >
> >
> > **************************************************************************
> >
> > Warning: The MATLAB C and Fortran API has changed to support MATLAB
> >
> > variables with more than 2^32-1 elements. In the near future
> >
> > you will be required to update your code to utilize the new
> >
> > API. You can find more information about this at:
> >
> > http://www.mathworks.com/help/techdoc/matlab_external/bsflnue-1.html
> >
> > Building with the -largeArrayDims option enables the new API.
> >
> > **************************************************************************
> >
> >
> >
> >
> >
> > Then after section 4 using mex -v yprime.c I get:
> >
> > -> gcc-4.2 -c -I/Applications/MATLAB_R2012a.app/extern/include
> > -DMATLAB_MEX_FILE -fno-common -no-cpp-precomp -arch x86_64 -isysroot
> > /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.5 -fexceptions
> > -DMX_COMPAT_32 -O2 -DNDEBUG "yprime.c"
> >
> >
> > yprime.c:17:18: error: math.h: No such file or directory
> >
> > In file included from
> > /usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/include/limits.h:15,
> >
> > from
> > /Applications/MATLAB_R2012a.app/extern/include/tmwtypes.h:43,
> >
> > from
> > /Applications/MATLAB_R2012a.app/extern/include/matrix.h:295,
> >
> > from
> > /Applications/MATLAB_R2012a.app/extern/include/mex.h:58,
> >
> > from yprime.c:18:
> >
> > /Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/include/limits.h:15:25:
> > error: no include path in which to search for limits.h
> >
> > In file included from
> > /Applications/MATLAB_R2012a.app/extern/include/mex.h:58,
> >
> > from yprime.c:18:
> >
> > /Applications/MATLAB_R2012a.app/extern/include/matrix.h:852:20: error:
> > stdlib.h: No such file or directory
> >
> > In file included from yprime.c:18:
> >
> > /Applications/MATLAB_R2012a.app/extern/include/mex.h:161:19: error: stdio.h:
> > No such file or directory
> >
> > yprime.c: In function 'yprime':
> >
> > yprime.c:52: warning: incompatible implicit declaration of built-in function
> > 'sqrt'
> >
> >
> > mex: compile of ' "yprime.c"' failed.
> >
> >
> > Error using mex (line 206)
> >
> > Unable to complete successfully.
> >
> >
> >
> >
> >>>> Dennis Thompson <[log in to unmask]> 3/28/2012 04:59 PM >>>
> >
> >
> > Try setting up mex following these instructions
> >
> > http://www.mathworks.com/support/tech-notes/1600/1605.html#setup
> >
> >
> >
> > On Wed, Mar 28, 2012 at 2:51 PM, Rodrigo Perea <[log in to unmask]> wrote:
> >> Hello,
> >> I am having problems correctly installing spm8 and compiling it as it
> >> shows in:
> >> http://en.wikibooks.org/wiki/SPM/Installation_on_64bit_Mac_OS_%28Intel%29
> >>
> >> After downloading Xcode4 and the make command tools (Preferences -->
> >> Downloads --> Command Line Tools
> >>
> >> I tried to use make. However when I tried make && make install, I got
> >> an error that gcc-4.2 could be found. So I tried thought of using gcc
> >> instead and after I go to /usr/bin/ I created a symbolic link (ln -s gcc
> >> gcc-4.2).
> >>
> >>
> >>
> >>
> >> Again I got the following error with the make command:
> >>
> >>
> >>
> >>
> >>
> >>
> >> /usr/local/spm8/src$ gcc --version
> >> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build
> >> 5658) (LLVM build 2336.9.00)
> >> Copyright (C) 2007 Free Software Foundation, Inc.
> >> This is free software; see the source for copying conditions. There is NO
> >> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> >> PURPOSE.
> >>
> >> rperea@kum-rhonea2:/usr/local/spm8/src$ make && make install
> >> _____________________________________________________________
> >>
> >> Unix compilation (MacOS X, Intel 64 bit)
> >> _____________________________________________________________
> >>
> >> mex -O -c spm_vol_utils.c -DSPM_UNSIGNED_CHAR
> >> spm_vol_utils.c:240:18: error: math.h: No such file or directory
> >> spm_vol_utils.c:241:20: error: stdlib.h: No such file or directory
> >> spm_vol_utils.c: In function ‘resample_uchar_0’:
> >> spm_vol_utils.c:258: warning: incompatible implicit declaration of
> >> built-in function ‘floor’
> >> spm_vol_utils.c: In function ‘resample_uchar_1’:
> >> spm_vol_utils.c:291: warning: incompatible implicit declaration of
> >> built-in function ‘floor’
> >> spm_vol_utils.c: In function ‘resample_d_uchar_1’:
> >> spm_vol_utils.c:336: warning: incompatible implicit declaration of
> >> built-in function ‘floor’
> >> spm_vol_utils.c: In function ‘slice_uchar_0’:
> >> spm_vol_utils.c:536: warning: incompatible implicit declaration of
> >> built-in function ‘floor’
> >> spm_vol_utils.c: In function ‘slice_uchar_1’:
> >> spm_vol_utils.c:591: warning: incompatible implicit declaration of
> >> built-in function ‘floor’
> >> spm_vol_utils.c: In function ‘slice_uchar’:
> >> spm_vol_utils.c:720: warning: incompatible implicit declaration of
> >> built-in function ‘fabs’
> >> spm_vol_utils.c:720: warning: incompatible implicit declaration of
> >> built-in function ‘floor’
> >>
> >> mex: compile of ' "spm_vol_utils.c"' failed.
> >>
> >> make: *** [utils_uchar.mexmaci64.o] Error 1
> >>
> >>
> >>
> >> Any help???
> >>
> >> In matlab when I tried to run spm preprocessing steps I get the following
> >> error:
> >>
> >> Warning: Default string does not match any button string name.
> >> Warning: Run spm_jobman('initcfg'); beforehand
> >>> In spm_jobman at 107
> >> In Dartel_Step2_PereaReviewed_v1_1 at 233
> >>
> >>
> >> ------------------------------------------------------------------------
> >> Running job #1
> >> ------------------------------------------------------------------------
> >> Running 'Run DARTEL (create Templates)'
> >> Continuing registration from pre-existing parameters
> >> (/Users/rperea/Desktop/Test_WMDartel/u_rc2H_1_2000_Template_WM_withcoreg_all.nii)
> >> Failed 'Run DARTEL (create Templates)'
> >> Error using dartel3 (line 206)
> >> Not compiled for MACI64 in MATLAB 7.14.0.739 (R2012a) (see make.m)
> >>
> >> In file "/usr/local/spm8/toolbox/DARTEL/dartel3.m" (v1359), function
> >> "dartel3" at line 206.
> >> In file "/usr/local/spm8/toolbox/DARTEL/spm_dartel_template.m" (v4064),
> >> function "spm_dartel_template" at line 66.
> >>
> >> No executable modules, but still unresolved dependencies or incomplete
> >> module inputs.
> >> The following modules did not run:
> >> Failed: Run DARTEL (create Templates)
> >> Skipped: Normalise to MNI Space
> >>
> >> Error using cfg_util (line 835)
> >> Job execution failed. The full log of this run can be found in MATLAB
> >> command window, starting
> >> with the lines (look for the line showing the exact #job as displayed in
> >> this error message)
> >> ------------------
> >> Running job #1
> >> ------------------
> >>
> >>
> >> Error in spm_jobman (line 217)
> >>
> >>
> >> Error in Dartel_Step2_PereaReviewed_v1_1 (line 233)
> >>
|