Dev-C++ Recipe for Target Failed - c++

I have a problem that really is driving me crazy right now. I have a project written in C++ and it's using pthread. I've compiled this project with Dev-C yesterday and everything was just perfect. However, today, I'm getting this nonsense "recipe for target 'project1.exe' failed" error. I didn't change anything, how come this project got broken by itself? I really don't get it. Please help me. Compile error is below:
> General: TDM-GCC 4.8.1 64-bit Release Building Makefile
> "E:\2013-2014\[CNG 334] OS\Course Project\New folder\Makefile.win"
> Executing make... mingw32-make.exe -f "E:\2013-2014\[CNG 334]
> OS\Course Project\New folder\Makefile.win" all g++.exe -c main.cpp -o
> main.o -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++"
g++.exe -c v1withupperandlowerletters.cpp -o
v1withupperandlowerletters.o -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++"
g++.exe main.o v1withupperandlowerletters.o -o Project1.exe
-L"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -static-libgcc
E:\2013-2014[CNG 334] OS\Course Project\New folder\Makefile.win:25:
recipe for target 'Project1.exe' failed
mingw32-make.exe: *** [Project1.exe] Error 1
Compilation succeeded in 4.41 seconds
Thank you very much.
Edit: Problem resolved. You can check my answer below.

It turned out strangely that my firewall program's sandbox feature was blocking Dev-C to create a new file from a project even though Dev-C++ itself was marked as a trusted program. I've disabled the sandboxing feature and it's working perfect.
I'm not deleting this topic since this may help some other person in the future. I'm using Comodo firewall and maybe other firewalls out there with sandboxing feature may raise the same problem.

Related

C++ CodeBlocks and wxWidgets file not found?

I'm pretty new to C::B and just installed it along with building wxWidgets. I'm pretty sure my wxWidgets build with MinGW is good, i was able to successfully create a wxWidgets project in C::B using the "minimal.cpp" sample in wxWidgets. However now instead of creating an empty project, I'm using leaving "Empty project" unchecked in wizard to create the program. With wxWidgets this creates 2 source files and 2 header files (for app and main). When I try to build+play the project though without making any changes i get this error:
-------------- Build: Debug in MULLSIMPLE (compiler: GNU GCC Compiler)---------------
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -D__WXDEBUG__ -I"C:\Program Files\wxWidgets-3.0.5\include" -I"C:\Program Files\wxWidgets-3.0.5\lib\gcc_dll\mswud" -c "C:\Users\gmloo\OneDrive\Desktop\C++ Projects\MULLSIMPLE\wx_pch.h" -o wx_pch.h.gch\Debug_wx_pch_h_gch
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -D__WXDEBUG__ -I"C:\Program Files\wxWidgets-3.0.5\include" -I"C:\Program Files\wxWidgets-3.0.5\lib\gcc_dll\mswud" -c "C:\Users\gmloo\OneDrive\Desktop\C++ Projects\MULLSIMPLE\MULLSIMPLEApp.cpp" -o obj\Debug\MULLSIMPLEApp.o
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -g -D__WXDEBUG__ -I"C:\Program Files\wxWidgets-3.0.5\include" -I"C:\Program Files\wxWidgets-3.0.5\lib\gcc_dll\mswud" -c "C:\Users\gmloo\OneDrive\Desktop\C++ Projects\MULLSIMPLE\MULLSIMPLEMain.cpp" -o obj\Debug\MULLSIMPLEMain.o
windres.exe -I"C:\Program Files\wxWidgets-3.0.5\include" -I"C:\Program Files\wxWidgets-3.0.5\lib\gcc_dll\mswud" -J rc -O coff -i C:\Users\gmloo\OneDrive\Desktop\C__PRO~1\MULLSI~1\resource.rc -o obj\Debug\resource.res
g++.exe -L"C:\Program Files\wxWidgets-3.0.5\lib\gcc_dll" -o bin\Debug\MULLSIMPLE.exe obj\Debug\MULLSIMPLEApp.o obj\Debug\MULLSIMPLEMain.o obj\Debug\resource.res -mthreads -lwxmsw30ud_core -lwxbase30ud -lwxpngd -lwxzlibd -mwindows
gcc: error: Files\wxWidgets-3.0.5\include: No such file or directory
gcc: error: Files\wxWidgets-3.0.5\lib\gcc_dll\mswud: No such file or directory
windres.exe: preprocessing failed.
Process terminated with status 1 (0 minute(s), 14 second(s))
Process terminated with status 0 (0 minute(s), 16 second(s))
3 error(s), 0 warning(s) (0 minute(s), 16 second(s))
Saying that it can't find files? the wxWidgets-3.0.5 is actually in c:\Program Files/wxWidgets-3.0.5, so maybe its looking in the wrong place? Or maybe I missed a step setting it up?
This is absolutely everything I did to install C::B, install wxWidgets, and create my project
1. Installing CodeBlocks
a. Clicked codeblocks-20.03mingw-setup.exe from website, then download started automaticallty from fosshub
b. Ran executable to install and for type of install did "All plugins, all tools, just everything"
-all checkboxes were checked, including
1. Default Install
2. Contrib Plugins
3. C::B CBP2Make
4. C::B Share Config
5. C::B Launcher
6. MinGW Compiler Suite
2. Downloading wxWidgets
a. Clicked "Windows ZIP" from downloads page on website under "Latest Stable Release: 3.0.5"
b. Extracted download to c:\Program Files\wxWidgets-3.0.5
-first file asked for administrator permission, i said "dont ask again" and clicked "continue"
3. Added MinGW to path
a. went into c:\Program Files\CodeBlocks\MinGW\bin and copied that path to PATH environment variables
4. Building wxWidgets
a. opened a terminal with admin privileges and went to c:\Program Files\wxWidgets-3.0.5\build\msw.
b. entered commands as suggested at https://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW, except changed
BUILD=release to BUILD=debug:
1. mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=debug clean
2. mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=debug
c. wxWidgets successfully built (3:38 pm to 4:22pm!)
5. Opened CodeBlocks
a. got message that "After auto-detection, at least one compiler's master path is still empty and therefore invalid.
Inspect the list below and change the compiler's master path later in the compiler options. Select you favourite
default compiler here:"
-There's one compiler listed as detected: GNU GCC Compiler
-With this compiler highlighted, i clicked "Set as default" and then ok.
b. got message CodeBlocks is not default app for C/C++ source files.
-Selected "Yes, associate with C/C++ files"
7. Testing Compiler
-I wasn't sure what to do about "setting compiler master path..." msg earlier, so I just created a new project with type
"Console application", compiled the basic "Hello world" application, ran it, ran fine, so I assume compiler is working?
6. Create new wxWidgets program:
a. Create new project: wxWidgets project
b. Wizard Steps:
PAGE 1:
-Set version: wxWidgets 3.0.x
PAGE 2:
-Named project "MULLSIMPLE" and created directory
PAGE 3:
-Skipped Author info.
PAGE 4:
-Preferred GUI Builder: None
-Application Type: Frame Based
PAGE 5:
-wxWidgets location: C:\Program Files\wxWidgets-3.0.5
-When I hit next, it opens the global variable editor. I don't know how to use this,
so i just hit ok without making any changes. IT asked if i want to save an invalid global var,
i said yes. Now the widgets location in the wizard is a path instead of a global variable,
I assume this is ok for now
PAGE 6:
-By default "Debug" configuration checked, "Release" configuration is unchecked
-make no changes
PAGE 7:
-Under wxWidgets library settings:
-CHECK Use wxWidgets DLL
-UNCHECK wxWidgets built as monolithic
-CHECK enable unicode
-Under Miscellaneous settings:
-UNCHECK create empty project
-CHECK create and use PCH
-Leave configuration input field blank
-UNCHECK Configure Advanced Options
-On next get dialog re PCH default settings, click YES to accept
PAGE 8:
-Didn't select any additional libs to add to project,
just hit finish
8. Try Build and run
-Get the build log error at start of post re: missing files
Thanks
#user4581301 thanks for your response it looks like that was the problem. I copied the wxWidgets-3.0.5 to the desktop. Then i opened up the old one in prog files, cleaned the build, then deleted that folder. Then i created a new C::B proj using the wxWidgets path to the one on the desktop, and now the error is gone.
I don't 100% understand how wxWidgets works so I hope just copying the whole folder to another location is fine, but so far program seems to be working. Thanks

Clang 4.0 debugging using Visual Studio

I have a project that I am still trying to setup using Clang and Visual Studio on Windows. As a caveat, I've worked on several c++ projects but they've all been mature projects where I haven't had to be involved in setting up make files or resolving dependencies hence why I want some experience in doing so.
As a clarification, I am not using the LLVM built into visual studio thing. My goal was to have visual studio be a convenience on top of having a project that can be built with make files but not using CMake.
So far, I have a solution with a single nmake project. This nmake project calls a build.bat file which calls into a make file. This make file looks like this:
# Based on PUXAN tutorial
# http://www.puxan.com/web/howto-write-generic-makefiles/
# Compiler choice
CC = clang++ -g -O0
CC_OBJ_FLAGS = -w -v -c
# Name of our executable and also the main run target
EXEC = ../bin/output.exe
# Here we get every cpp file in the source directory to make a list of source files
SOURCES = $(wildcard ../src/*.cpp)
# Here we have mapped all the cpp files to o files and now have a list of o files
TMP_OBJECTS = $(SOURCES:.cpp=.o)
OBJECTS = $(foreach obj,$(TMP_OBJECTS),$(subst src,obj,$(obj)))
INC = -I../lib/glfw-3.2.1/include
LINK = -L../lib/glfw-3.2.1/lib-vc2015 -lglfw3dll -lglfw3 -lopengl32
# compile list of o files into executable
# NOTE: when make is run without a target, the first target is chosen. This target
# should remain the first at all times
$(EXEC): $(OBJECTS)
$(CC) $(LINK) $(OBJECTS) -o $(EXEC)
# As each o file becomes a target, compile the associated cpp file into the o file
../obj/%.o: ../src/%.cpp
$(CC) $(CC_OBJ_FLAGS) $(INC) $< -o $#
# Remove the entire list of objects and the executable
clean:
rm -f $(EXEC) $(OBJECTS)
rebuild:
make -B
You'll notice that I've included the -g and -O0 flags which should output symbols and sure enough, I get a pdb file generated for output.exe (and also all the o files but I can clean that up later). When I go to debug the project in Visual Studio however, it says the symbols for the module are loaded but breakpoints aren't hitting which I think is pointing to the pdb not having references to the source. Here is the debug output in Visual Studio:
'output.exe' (Win32): Loaded 'W:\Scratch\Engine\bin\output.exe'. Symbols loaded.
Posts about Clang from 2016 and earlier mention that it doesn't generate PDB files yet and that thats a work in progress and sure enough the Clang compability site (https://clang.llvm.org/docs/MSVCCompatibility.html) mentions how debug info is a work in progress but that I should be able to generate CodeView info using /Z with 7 or i. I have tried passing both /Zi and /Z7 to clang and to the linker directly but clang complains about them and the linker ignores them with a warning. This documentation claims to be from Clang 6 that is, from what I can tell, not released yet and is experimental. However, using Clang 4.0 with -g flag, I am indeed able to generate pdb files.
Does anyone have any further information on this? Is there anything else I can provide to determine if I have set all this up correctly? Am I just missing a flag that would correctly provide the sources or am I missing a setting in visual studio to pick the sources? I tried setting sources manually in visual studio at the project and solution level to no effect. Should I look at the pdb file with a pdb viewer of some kind and see if the source paths are there?
Thanks in advance to any help.
The clang option equivalent to -Z7/-Zi is called -gcodeview (and has to be used in addition to -g). For MSVC-style command line options, you need to use the clang-cl compiler driver instead.
For the MSVC Version ( https://llvm.org/builds/) it works like in the following picture but to set clang on VS2017 up you need to install Microsoft's Platform Toolset V1.40 first:
VS2017 Clang debug
Project -> Properties -> C/C++ -> Commandline -> Options: "/Z7"

Netbeans c++ compiler searches for deleted file

I'm working on a Ubuntu 16.04 and Netbeans 8.0.2
I deleted a source file and the corresponding header file, because I had no use for it anymore.
When I want to compile my code (clean + build), I get the following error:
make[2]: *** no rule to make target source_files/SolveODEwithAST.cpp“,
benötigt von „build/Debug/GNU-Linux-x86/source_files/SolveODEwithAST.o“, zu erstellen. Schluss.
-> My makefile is still looking for the deleted file.
I started to search in the makefile for the command to compile this deleted file:
I found the following:
in
Makefile-Release:
${OBJECTDIR}/source_files/SolveODEwithAST.o: source_files/SolveODEwithAST.cpp
${MKDIR} -p ${OBJECTDIR}/source_files
${RM} "$#.d"
$(COMPILE.cc) -O2 -MMD -MP -MF "$#.d" -o ${OBJECTDIR}/source_files/SolveODEwithAST.o source_files/SolveODEwithAST.cpp
and it is defined in the OBJECTFILES variable.
I deleted these lines of code, but the lines reappear after building the code.
So how can I change my makefile to make my code work again?
For all files in the projects /nbproject directory I searched for the deleted filenames.
$ls
configurations.xml Makefile-Debug.mk Makefile-impl.mk Makefile-Release.mk Makefile-variables.mk Package-Debug.bash Package-Release.bash private project.xml
It is important to delete the corresponding lines in the .xml files.
When I just delete the corresponding lines in the Makefiles, the lines reappear.

CodeBlocks : [highlight: No such directory found

I have already read the other questions on the site and none of them matched with the issue I had.
I have already tried unistalling and then reinstalling codeblocks.
Please help.
Build Log :
mingw32-g++.exe -Wall -fexceptions -g -c S:\Coding\C++\aloo\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -o bin\Debug\aloo.exe obj\Debug\main.o
[highlight color=”yellow”]-lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32[/highlight] "C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a"
mingw32-g++.exe: error: [highlight: No such file or directory
mingw32-g++.exe: error: color=”yellow”]-lbgi: No such file or directory
mingw32-g++.exe: error: C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a: No such file or directory
Process terminated with status 1 (0 minute(s), 4 second(s))
3 error(s), 0 warning(s) (0 minute(s), 4 second(s))
I have successfully solved the problem.
All I did was go to "Compiler Settings" ("Settings" -> "Compiler" -> Global compiler settings), and selected "Reset Defaults".
It solved the problem.
Thanks everyone for answering. :)
Start by turning on full Compiler logging.
This is done by selecting the "Full command line" option Under menu "Settings" -> "Compiler" -> Global compiler settings -> [the compiler you use] -> "Other Setting" tab, "Compiler logging". In 12.11 and newer this is enabled by default.
This option will make Code::Blocks output the exact commands it uses to compile your code.
Things to remember:
Look at the "Build Log" NOT the "Build Message" tab
Do a re-build instead of build in order to get a full build log.
You should review all the commands and their options;
If you have compiled your app before, do a re-build (or clean before build) to see all compiling / linking steps;
If you don't know what an option or a command does please read the documentation for the compiler/linker you're using;
Look for missing commands;
For every source file (.cpp; .c; .d; etc) in your project, you must have at least one command in the log. This command must produce an object file (file extension .o if using gcc/g++ and .obj if using Visual Studio);
Every object file should be linked in the final executable, if not there are undefined symbols errors;
Remember the file extension matters: *.c is compiled as C file, *.cpp is compiled as C++ file.
If you have no luck, you can try to ask in the forum, but read first "How do I report a compilation problem on the forums"
From Code::Blocks FAQ

C++ error on linux machine: ccpentium: No input files

I am writing a code for MRI scanner where all calculation is being done on a Windows machine, while waveforms are being played using linux.
Inside my code, when I declare
#include <vector>
and try to compile it on linux, I start getting errors like this:
ccpentium: FLASH.cpp: No such file or directory
ccpentium: No input files
Any help would be appreciated.
More detailed error:
export PATH=z:/n4_fsp/tornado/i86/host/x86-win32/bin:C:/WINDOWS/system32:C:/WINDOWS:C:/WINDOWS/system32/Wbem; z:/n4_fsp/tornado/i86/host/x86-win32/bin/ccpentium.exe -O1 -Wall -DTOOL_FAMILY=gnu -DTOOL=gnu -ansi -DVXWORKS -DUNICODE -D_UNICODE -mcpu=pentium -march=pentium -fvolatile -nostdlib -fno-builtin -fno-defer-pop -DCPU=PENTIUM -malign-double -D_CONSOLE -DCEST_OffsetSeries -DBUILD_SEQU -DBUILD_CEST_OffsetSeries -Iz:/n4/pkg -Iz:/n4/tool -Iz:/n4_prod/i86/prod/include -Iz:/n4_deli_vb15a/i86/del
ivery/include -Iz:/n4/x86/prod/include -Iz:/n4/x86/delivery/include -Iz:/n4/pkg/MrServers/MrMPCUSystem/Tornado_i86/target/h -Iz:/n4_extsw/x86/extsw/include -o FLASH.oi86 -c FLASH.cpp
In file included from z:/n4_fsp/tornado/i86/host/x86-win32/lib/gcc-lib/i586-wrs-vxworks/2.9-PentiumIII-010221/include/syslimits.h:7,
from z:/n4_fsp/tornado/i86/host/x86-win32/lib/gcc-lib/i586-wrs-vxworks/2.9-PentiumIII-010221/include/limits.h:11,
from z:/n4_fsp/tornado/i86/host/x86-win32/include/g++-3/stl_algobase.h:49,
from z:/n4_fsp/tornado/i86/host/x86-win32/include/g++-3/algobase.h:36,
from z:/n4_fsp/tornado/i86/host/x86-win32/include/g++-3/vector.h:30,
from FLASH.cpp:33:
z:/n4_fsp/tornado/i86/host/x86-win32/lib/gcc-lib/i586-wrs-vxworks/2.9-PentiumIII-010221/include/limits.h:117:60: limits.h: No such file or directory
ccpentium: FLASH.cpp: No such file or directory
ccpentium: No input files
ccpentium: FLASH.cpp: No such file or directory
ccpentium: No input files
ccpentium: FLASH.cpp: No such file or directory
ccpentium: No input files
idea_make: *** [FLASH.oi86] Error 1
20:03:23 ERROR sde::fDos: <idea_make.exe --unix -f CEST_OffsetSeries.mk i86Release> failed with status=2
20:03:23 ERROR sde idea_make.exe --unix -f CEST_OffsetSeries.mk i86Release failed
20:03:23 INFO sde Copying \n4\i86\prod\lib\CEST_OffsetSeries.i86 to c:\Temp\CEST_OffsetSeries.i86
1 Datei(en) kopiert.
The error is caused by the combination of
-nostdlib
flag which asks the compiler not to use its standard linking environment and missing files from your include paths.
From very recent experience, I was missing two files from the include:
-Iz:/n4/pkg/MrServers/MrMPCUSystem/Tornado_i86/target/h
Eventually, I manually copied them from an updated version, but I do not know whether this is a bug or a 'feature' of the older version, so it still remains to be tested whether the compiled code does not break the scanner.