c++ - recipe for target 'Project1.exe' failed -


i try compile simple c file in dev-c++ , shows error on line 25 c:\users\varun\desktop\cprog\makefile.win recipe target 'project1.exe' failed.

makefile.win

# project: project1 # makefile created dev-c++ 5.6.2  cpp      = g++.exe cc       = gcc.exe windres  = windres.exe obj      = main.o untitled2.o linkobj  = main.o untitled2.o libs     = -l"c:/program files (x86)/dev-cpp/mingw64/lib" -l"c:/program files (x86)/dev-cpp/mingw64/x86_64-w64-mingw32/lib" -static-libgcc incs     = -i"c:/program files (x86)/dev-cpp/mingw64/include" -i"c:/program files (x86)/dev-cpp/mingw64/x86_64-w64-mingw32/include" -i"c:/program files (x86)/dev-cpp/mingw64/lib/gcc/x86_64-w64-mingw32/4.8.1/include" cxxincs  = -i"c:/program files (x86)/dev-cpp/mingw64/include" -i"c:/program files (x86)/dev-cpp/mingw64/x86_64-w64-mingw32/include" -i"c:/program files (x86)/dev-cpp/mingw64/lib/gcc/x86_64-w64-mingw32/4.8.1/include" -i"c:/program files (x86)/dev-cpp/mingw64/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++" bin      = project1.exe cxxflags = $(cxxincs)  cflags   = $(incs)  rm       = rm.exe -f  .phony: all-before all-after clean clean-custom  all: all-before $(bin) all-after  clean: clean-custom     ${rm} $(obj) $(bin)  $(bin): $(obj)     **$(cc) $(linkobj) -o $(bin) $(libs)**  main.o: main.c     $(cc) -c main.c -o main.o $(cflags)  untitled2.o: untitled2.c     $(cc) -c untitled2.c -o untitled2.o $(cflags) 

errors

c:\users\varun\desktop\cprog\untitled2.o    untitled2.c:(.text+0x0): multiple definition of `main' c:\users\varun\desktop\cprog\main.o main.c:(.text+0x0): first defined here c:\users\varun\desktop\cprog\collect2.exe   [error] ld returned 1 exit status 25      c:\users\varun\desktop\cprog\makefile.win   recipe target 'project1.exe' failed 

the important bit of output is:

c:\users\varun\desktop\cprog\untitled2.o    untitled2.c:(.text+0x0): multiple definition of `main' 

it tells you, have 2 definitions of function main. need 1 such definition in executable. next line of error tells you, definition is:

c:\users\varun\desktop\cprog\main.o main.c:(.text+0x0): first defined here 

so have function main defined in untitled2.c , have function main defined in main.c. delete 1 of them. names perhaps main.c unnecessary altogether, can't tell without seeing files.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -