Long double is printed incorrectly in CodeBlocks using MinGW/long double
The problem:
My code work's fine using Cygwin (long double is printed like having 16 bytes of memory, and the min, and max values are OK), but using MinGW the CodeBlocks say long double have 12 bytes of memory (if I modify the code to show the size in int instead long double, in long double is -2,000000), and the min and max values it's printed like -0,000000 both.
Codeblocks version: 20.03.
MinGW-W64 project (version 8.1.0, 32/64 bit, SEH).
I tried with the prompt but, is the same thing!
I saw in a post that this problem is generated by Windows, but if it works with Cygwin, then there is a solution that maybe someone somewhere knows...
Observation:
I can use Cygwin, but Portuguese has so many accented words, and I use them to name my directories, so when I use Cygwin the things are complicated, and I don't know how can I include some libs like conio.h correctly, and the MinGW has included libs like conio.h so I prefer to learn how to resolve this problem.
#include <stdio.h>
#include <math.h>
int main()
{
// Declaration of variables
long double min, max, size;
// Size
size = sizeof(long double);
// Min and Max
min = pow(2, (sizeof(long double)*8))*(-1);
max = pow(2, (sizeof(long double)*8));
// Print of results
printf("Size of long double: %Lf\n", size);
printf("Min of long double: %Lf\n", min);
printf("Max of long double: %Lf\n", max);
// end of main
return(0);
}
In mingw:
In cygwin:
1 answer
-
answered 2021-04-08 15:43
FabQrz
Download separated "MinGW-W64 Online Installer" (the mingw included in the codeblocks is 32bits because this is printed 12bit)
and
Install the version 7.3.0. (the version 8.1.0 is bugged because this is printed 0.000000 or -0.000000).
See also questions close to this topic
-
C language factorial function
The code below is running wrong. If I give the function 4 value, it returns the number -861720576. Can you help?
#include <stdio.h> int fact(int x) { if (x<0) { return -1; } else if (x==0) { return 1; } else if (x==1) { return 1; } else { for (int i=2;i<x;i++) { x*=i; } return x; } } int main() { printf("%d",fact(4)); return 0; }
.................................
-
Program to find smallest 5 values in a matrix using C
I'm trying to find the smallest 5 values in a 6*6 matrix using C. Note I was successful in finding the least value as well as finding the least values from a 1D array, but could not make it to iterate and get the least 5 values of the matrix using 2D. Any ideas appreciated.
[The sample of a matrix I want to sort and get the lowest values]
2.36^2 5.01^2 1.00^3 1.25^3 1.09^2 2.98^2 1.09^2 2.50^3 1.81^5 -
Send signal to another process on Windows with C (alternative to kill of POSIX)
I am working to port a C/Fortran package that was written for POSIX systems to Windows. Most of the Fortran part of the software runs mathematical calculations. The C codes act as interfaces between Fortran and the system. The code is fully console-based and does not have a GUI.
The software is parallelised with MPI, i.e. after launch it runs multiple processes - one master process and several child processes.
Now, one of the hurdles I have faced with porting is the C code that deals with signal. The master process and child processes each have their signal handlers. The way the signal handling is implemented is that, when the master process receives the SIGTERM or SIGSEGV, it sends those to the child processes. In POSIX, that is implemented by
kill(pid, SIGTERM)
. The signal handler of the child processes then interact with the Fortran part to gracefully bring the program to an exit.What would be the best strategy to port this behaviour to Windows? I am not much familiar with Fortran so I would leave the fortran part untouched if I can. The only thing I have to ensure is that somehow the master process communicates with child processes via their PID, then I have enough to start writing code.
I have asked questions about an alternative to
kill()
on Windows, and it seems like there is no easy alternative. Please add an answer even if it means I have to modify a lot of code. The C signal code can be seen in another question I asked about this here.(Please don't mention cygwin or WSL. Cygwin fails to compile it, and I need to run it from Windows, WSL binaries don't work outside of it)
-
Is cygwin possible to install epoll.h on win10?
I compile a linux network project with cygwin32 on win10.
The reason for doing this is that I can use comfortable IDE coding envrionment and donot need switch to linux environment to do real-time compilation.
Cygwin shows non-found file error.fatal error: sys/epoll.h: No such file or directory 6 | #include <sys/epoll.h>
Does this mean epoll is something only available in the linux 2.6 kernel? Cygwin has most but not all linux feature?
-
Start cmd.exe from cygwin shell with original Windows environment variables?
I cannot use vcvarsall.bat from cygwin because cygwin overwrites environment variables (like PATH) and then the environment in cmd.exe, which is inherited from the cygwin BASH environment, finds the wrong cmake.exe.
Is there any pre-defined way to do this? Maybe without having to resort to opening a new shell window? Currently, I'm rewriting and stripping the entire PATH string. But now I have another issue: TEMP points to the wrong directory. I could just change that manually, but I really want it to adhere to original Windows behaviour.
-
No Gearman worker available
Hello everyone I am having issues starting an Gearman woker in Windows I keep on getting this error.
500 | Internal Server Error | Net_Gearman_Exception No Gearman worker available that can handle the job arFileImportJob.
I have the Gearmand Server running in cygwin64, and I already installed PECL with gearman.
Thanks for the help
-
Why cannot find -lole32,-luuid TDM-GCC64 + Go + GTK?
I am trying to create a user interface in Go with GTK, after installing everything as follows:
- https://www.gtk.org/docs/installations/windows/
- Fix -Wl errors
- Install TDM-GCC-64
After all these steps, I run "go run main.go" and I get the following response:
# github.com/mattn/go-gtk/glib In file included from glib.go:5, from _cgo_export.c:4: ..\..\pkg\mod\github.com\mattn\go-gtk@v0.0.0-20191030024613-af2e013261f5\glib/glib.go.h:183:1: warning: 'GThreadFunctions' is deprecated [-Wdeprecated-declarations] 183 | static void _g_thread_init(GThreadFunctions *vtable) { | ^~~~~~ In file included from C:/msys64/mingw64/include/glib-2.0/glib.h:111, from ..\..\pkg\mod\github.com\mattn\go-gtk@v0.0.0-20191030024613-af2e013261f5\glib/glib.go.h:4, from glib.go:5, from _cgo_export.c:4: C:/msys64/mingw64/include/glib-2.0/glib/deprecated/gthread.h:56:8: note: declared here 56 | struct _GThreadFunctions | ^~~~~~~~~~~~~~~~~ # github.com/mattn/go-gtk/glib In file included from ..\..\pkg\mod\github.com\mattn\go-gtk@v0.0.0-20191030024613-af2e013261f5\glib\glib.go:5: ..\..\pkg\mod\github.com\mattn\go-gtk@v0.0.0-20191030024613-af2e013261f5\glib/glib.go.h:183:1: warning: 'GThreadFunctions' is deprecated [-Wdeprecated-declarations] 183 | static void _g_thread_init(GThreadFunctions *vtable) { | ^~~~~~ In file included from C:/msys64/mingw64/include/glib-2.0/glib.h:111, from ..\..\pkg\mod\github.com\mattn\go-gtk@v0.0.0-20191030024613-af2e013261f5\glib/glib.go.h:4, from ..\..\pkg\mod\github.com\mattn\go-gtk@v0.0.0-20191030024613-af2e013261f5\glib\glib.go:5: C:/msys64/mingw64/include/glib-2.0/glib/deprecated/gthread.h:56:8: note: declared here 56 | struct _GThreadFunctions | ^~~~~~~~~~~~~~~~~ cgo-gcc-prolog: In function '_cgo_1efdb3e50950_Cfunc__g_thread_init': cgo-gcc-prolog:192:3: warning: 'GThreadFunctions' is deprecated [-Wdeprecated-declarations] In file included from C:/msys64/mingw64/include/glib-2.0/glib.h:111, from ..\..\pkg\mod\github.com\mattn\go-gtk@v0.0.0-20191030024613-af2e013261f5\glib/glib.go.h:4, from ..\..\pkg\mod\github.com\mattn\go-gtk@v0.0.0-20191030024613-af2e013261f5\glib\glib.go:5: C:/msys64/mingw64/include/glib-2.0/glib/deprecated/gthread.h:56:8: note: declared here 56 | struct _GThreadFunctions | ^~~~~~~~~~~~~~~~~ # github.com/mattn/go-gtk/gdk C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lole32,-luuid collect2.exe: error: ld returned 1 exit status
-
Recipe for target rule and all C++ CLion Windows one file
I am trying to run an SFML program in CLion. I keep getting an error:
"C:\Program Files\JetBrains\CLion 2020.3.2\bin\cmake\win\bin\cmake.exe" --build C:\Users\filip\CLionProjects\SFML_try1\cmake-build-debug --target SFML_try1 -- -j 6 mingw32-make.exe[3]: *** No rule to make target '/SFML/lib/sfml-system-d.lib', needed by 'SFML_try1.exe'. Stop. mingw32-make.exe[2]: *** [CMakeFiles/SFML_try1.dir/all] Error 2 mingw32-make.exe[1]: *** [CMakeFiles/SFML_try1.dir/rule] Error 2 mingw32-make.exe: *** [SFML_try1] Error 2 CMakeFiles\Makefile2:94: recipe for target 'CMakeFiles/SFML_try1.dir/all' failed CMakeFiles\Makefile2:101: recipe for target 'CMakeFiles/SFML_try1.dir/rule' failed Makefile:137: recipe for target 'SFML_try1' failed
I don't know anything about CMake. I use Windows, CLion, MinGW32, SFML. I don't even know where to look to fix this problem so this is why I don't post any code.
-
why does openblas when building in msys think I'm using Cygwin
I have been building OpenBLAS with some specific flags for awhile now under MSYS2. Recently, I setup a new install of MSYS2 under Windows 10. After doing the standard
pacman -Syu
a few times and then installing the needed toolingpacman -S gcc gcc-fortran make cmake git
I cloned the OpenBLAS repo, and didmake USE_OPENMP=1 USE_LOCKING=1
and when it finished it had created a dllcygopenblas.dll
instead of the normallibopenblas.dll
and it reported that it detected the os as:OS ... CYGWIN_NT
.when before it was:
OS ... WINNT
.In addition, when it was looking for libraries, before (when I set this up previously) it was looking for things like
libgomp-1.dll
in theC:\msys64\mingw64\bin\
directory and now its looking formsys-gomp-1.dll
in theC:\msys64\usr\bin
directory.I'm not exactly sure if I did something differently, or if the system has been updated in some way, but I also don't know what it is that dictates these differences in behavior and am looking for some guidance as to what controls where msys is looking for things and why it things my os is CYGWIN_NT when before I think it was WINNT.
I know for this round I did all of my pacman installs through the terminal opened with the "MSYS2" terminal shortcut, whereas I built my programs in the terminal opened with the "MSYS2 MinGW 64-bit" terminal shortcut. I am pretty sure I did that the last time too, but maybe I am misremembering.
I know that's a bit fuzzy, but any guidance would be appreciated. Also any comment on whether any of this makes any difference other than looking in different places for libraries with different names but everything else is the same or actually things are different, would be appreciated.
-
How can I fix building errors for Google Test in Code::Blocks?
Before I begin, I want to say that I am aware of this question, but no answer was satisfactory. Maybe because this question was asked in 2012 and things might have changed until 2021.
I want to use Google Test with Code::Blocks to write some tests. In order to do this, I downloaded the latest version from Github and built it with the last version of CMake.
In the next step, I opened the project file with it and I tried to build it. As a result, I got the following error messages:
||=== Build: all in googletest-distribution (compiler: GNU GCC Compiler) ===| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\include\gtest\internal\gtest-port.h||In function 'int testing::internal::posix::StrCaseCmp(const char*, const char*)':| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\include\gtest\internal\gtest-port.h|1979|error: '_stricmp' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\include\gtest\internal\gtest-port.h|1979|note: suggested alternative: 'strncmp'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\include\gtest\internal\gtest-port.h||In function 'char* testing::internal::posix::StrDup(const char*)':| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\include\gtest\internal\gtest-port.h|1981|error: '_strdup' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\include\gtest\internal\gtest-port.h|1981|note: suggested alternative: 'StrDup'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\include\gtest\internal\gtest-port.h||In function 'int testing::internal::posix::FileNo(FILE*)':| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\include\gtest\internal\gtest-port.h|1989|error: '_fileno' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\include\gtest\internal\gtest-port.h|1989|note: suggested alternative: 'file'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\include\gtest\internal\gtest-port.h||In function 'FILE* testing::internal::posix::FDOpen(int, const char*)':| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\include\gtest\internal\gtest-port.h|2035|error: 'fdopen' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\include\gtest\internal\gtest-port.h|2035|note: suggested alternative: 'fopen'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest.cc|1940|error: '_wcsicmp' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest.cc|1940|note: suggested alternative: 'wcsncmp'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest.cc||In member function 'int testing::UnitTest::Run()':| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest.cc|4900|error: '_OUT_TO_STDERR' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest.cc|4900|error: '_set_error_mode' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest.cc|4900|note: suggested alternative: 'SetErrorMode'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest.cc|4920|error: '_CRT_ASSERT' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest.cc|4920|note: suggested alternative: 'C_ASSERT'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest.cc|4921|error: '_CRTDBG_MODE_FILE' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest.cc|4921|error: '_CRTDBG_MODE_DEBUG' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest.cc|4920|error: '_CrtSetReportMode' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest.cc|4920|note: suggested alternative: 'SetErrorMode'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest.cc|4922|error: '_CRTDBG_FILE_STDERR' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest.cc|4922|error: '_CrtSetReportFile' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-death-test.cc||In function 'void testing::internal::DeathTestAbort(const string&)':| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-death-test.cc|296|error: '_exit' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-death-test.cc|296|note: suggested alternative: '_Exit'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-death-test.cc||In member function 'virtual void testing::internal::DeathTestImpl::Abort(testing::internal::DeathTest::AbortReason)':| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-death-test.cc|527|error: '_exit' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-death-test.cc|527|note: suggested alternative: '_Exit'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-death-test.cc||In member function 'virtual testing::internal::DeathTest::TestRole testing::internal::WindowsDeathTest::AssumeRole()':| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-death-test.cc|771|error: '_MAX_PATH' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-death-test.cc|771|note: suggested alternative: 'MAX_PATH'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-death-test.cc|773|error: 'executable_path' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-death-test.cc|308|note: in definition of macro 'GTEST_DEATH_TEST_CHECK_'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-death-test.cc|797|error: 'executable_path' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-death-test.cc|308|note: in definition of macro 'GTEST_DEATH_TEST_CHECK_'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-filepath.cc|49|error: '_MAX_PATH' was not declared in this scope| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-filepath.cc|101|note: in expansion of macro 'GTEST_PATH_MAX_'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-filepath.cc|49|note: suggested alternative: 'MAX_PATH'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-filepath.cc|101|note: in expansion of macro 'GTEST_PATH_MAX_'| C:\Users\alexz\OneDrive\Desktop\googletest-release-1.10.0\googletest\src\gtest-filepath.cc|102|error: 'cwd' was not declared in this scope| googletest\CMakeFiles\gtest.dir\build.make|75|recipe for target 'googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj' failed| CMakeFiles\Makefile2|170|recipe for target 'googletest/CMakeFiles/gtest.dir/all' failed| C:\Users\alexz\OneDrive\Programe\C\Testare program C\Google Test\Makefile|144|recipe for target 'all' failed| ||=== Build failed: 23 error(s), 0 warning(s) (0 minute(s), 5 second(s)) ===| ||=== Run: all in googletest-distribution (compiler: GNU GCC Compiler) ===|
As I see, the errors appear in only two files. I tried all the answers in the aforementioned question, without success at all.
How can I fix those errors, so I can finally begin to write my test cases and go on with my work?
-
Creating an array of strings from a file of unknown size
You will need to write a program to manage a student's course list with the following requirements: Store course data in a file with the following information: Course name, Course ID, Meeting Day(s) and Times along with Building. Room, and Instructor. (e.g., Computer Science I, CSC201, Mon, Wed, 9:00, 10:40, Online, Zoom, S. Davis) The file should be structured with each course on a separate line and each data item separated by a comma.
And one of the requirements is:The list of courses should be stored in an array. (Read from the file at the start and then saved to the file at the end.)
It doesnt work, it displays the last line of the file 3 times. i assume its 3 times because i have 3 lines in my file. We cannot use vectors, it has to be an array This is what i have:
void courseDisplay(ifstream& inData) { int x=0; //counter for lines in the file string str; while(getline(inData,str)) // counting number of lines in the file x++; std::string crs[x]; // declaring an array with x number of elements do { for (int i=0;i<x;i++) { inData>> str; crs[i]=str; std::cout<<crs[i]<<endl; } }while (getline(inData,str)); cout<<endl; }
-
How do you debug using 'Code::Blocks 20.03' (the "mingw" version)?
I want to ask this question even though it might be tagged as a duplicate.
I have built a 'Console Application' using 'Code::Blocks 20.03', which was installed using 'codeblocks-20.03mingw-setup.exe'. The defaults for the installation directory(see Note01) and the installation type (Full), were used.
I tried to Debug by using the Debug menu, clicking 'Start/Continue', and debugging failed.
I guess the important information from the log of what happened is
"Starting the debuggee failed: No executable specified, use `target exec'."
The full output from trying to debug is given below.
So my question is, how do you debug using 'Code::Blocks 20.03' (the "mingw" version)?
Full Output from trying to run a debugging session follows.
================================ Active debugger config: GDB/CDB debugger:Default Building to ensure sources are up-to-date Selecting target: Debug Adding source dir: C:\CodeBlocks20.03Small\ConsoleApplication\program01INc
Adding source dir: C:\CodeBlocks20.03Small\ConsoleApplication\program01INc
Adding file: C:\CodeBlocks20.03Small\ConsoleApplication\program01INc\bin\Debug\program01INc.exe Changing directory to: C:/CodeBlocks20.03Small/ConsoleApplication/program01INc/. Set variable: PATH=.;C:\Program Files\CodeBlocks\MinGW\bin;C:\Program Files\CodeBlocks\MinGW;C:\Program Files\Microsoft MPI\Bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files (x86)\Skype\Phone;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd;C:\Users\Roger.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn;c:\Program Files\Microsoft SQL Server\110\DTS\Binn;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\FreeFem++;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Roger\AppData\Local\Programs\Python\Python38-32\Scripts;C:\Users\Roger\AppData\Local\Programs\Python\Python38-32;C:\Users\Roger\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64;C:\texlive\2017\bin\win32;C:\Users\Roger\AppData\Local\Microsoft\WindowsApps;;C:\Program Files (x86)\clisp-2.49 Starting debuggee: C:\MinGW\bin\gdb.exe -nx -fullname -quiet -args C:/CodeBlocks20.03Small/ConsoleApplication/program01INc/bin/Debug/program01INc.exe done Setting breakpoints Debugger name and version: GNU gdb (GDB) 7.6.1 Starting the debuggee failed: No executable specified, use `target exec'. Debugger finished with status 0In building my project I used the defaults from the 'Select Compiler Dialog Box'.
Note01: It looks as if you should (date 11th April 2021) always use the default directory, to install. I installed a version of Code::Blocks in 'C:\Program Files\CodeBlocksSmall' when I went to uninstall it, the uninstaller would only accept 'C:\Program Files\CodeBlocks' as the directory to uninstall from. I deleted the CodeBlocksSmall directory manually.
Related question Starting the debuggee failed: No executable specified, use `target exec'
=======================
I have hopefully made progress towards an answer.
It looks as if a prior installation of 'MinGW' was inadvertently being used by the attempted debugging session(this is no longer possible). See the involvement of the file
"C:\MinGW\bin\gdb.exe", in the line
"Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname -quiet -args"
It looks to me as if I need to at least change the behaviour indicated by the above line, to
"Starting debugger: C:\Program Files\CodeBlocks\MinGW\bin\gdb.exe -nx -fullname -quiet -args"
Now when I try to run a debugging session failure occurs differently, see below
Active debugger config: GDB/CDB debugger:Default Building to ensure sources are up-to-date Selecting target: Debug Adding source dir: C:\Codeblocks20.03\ConsoleApp\program01INcForAnswer
Adding source dir: C:\Codeblocks20.03\ConsoleApp\program01INcForAnswer
Adding file: C:\Codeblocks20.03\ConsoleApp\program01INcForAnswer\bin\Debug\program01INcForAnswer.exe Changing directory to: C:/Codeblocks20.03/ConsoleApp/program01INcForAnswer/. Set variable: PATH=.;C:\Program Files\CodeBlocks\MinGW\bin;C:\Program Files\CodeBlocks\MinGW;C:\Program Files\Microsoft MPI\Bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files (x86)\Skype\Phone;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd;C:\Users\Roger.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn;c:\Program Files\Microsoft SQL Server\110\DTS\Binn;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\FreeFem++;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Roger\AppData\Local\Programs\Python\Python38-32\Scripts;C:\Users\Roger\AppData\Local\Programs\Python\Python38-32;C:\Users\Roger\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64;C:\texlive\2017\bin\win32;C:\Users\Roger\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\clisp-2.49 Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname -quiet -args C:/Codeblocks20.03/ConsoleApp/program01INcForAnswer/bin/Debug/program01INcForAnswer.exe failed -
Installed sublime text 3 for c++ but showing "No such file or directory" include "wchar.h"
I've been trying to run simple c++ program
#include<iostream> using namespace std; void main(){ cout<<"helloworld"; }
But got a error like this:
In file included from d:\mingw\lib\gcc\mingw32\9.2.0\include\c++\bits\postypes.h:40:0, from d:\mingw\lib\gcc\mingw32\9.2.0\include\c++\iosfwd:40, from d:\mingw\lib\gcc\mingw32\9.2.0\include\c++\ios:38, from d:\mingw\lib\gcc\mingw32\9.2.0\include\c++\ostream:38, from d:\mingw\lib\gcc\mingw32\9.2.0\include\c++\iostream:39, from my.cpp:1: d:\mingw\lib\gcc\mingw32\9.2.0\include\c++\cwchar:44:10: fatal error: wchar.h: No such file or directory #include <wchar.h> ^ compilation terminated."
I have updated sublime-build file for windows and also changed environment variables. Please help me to fix this error in sublime. I am using MinGW compiler.
-
What is the CMake command to copy a resource directory to a build directory?
I am learning CMake in hurry at random order. I have a workspace in which an OpenCV project is being developed. The project contains a directory
resources
containing some images for testing.During the development, I often have to build and run the app so the
resources
directory must be copied to the build before I can run it. If the previous build has already contain theresources
directory, don't need to recopy it unless there are some changes in theresources
directory.cmake_minimum_required(VERSION 3.0.0) project(cpp-opencv-project VERSION 0.1.0) find_package(OpenCV REQUIRED) include_directories(${OpenCV_INCLUDE_DIRS}) add_executable(${PROJECT_NAME} codes/main.cpp) target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS}) set(CPACK_PROJECT_NAME ${PROJECT_NAME}) set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) include(CPack)
Question
What is the CMake code to smartly copy the
resources
directory tobuild
directory?