Eclipse CDT plugin problems - c

im trying to run a c program on my windows 7 computer using eclipse and im running into a little snag. I currently have Eclipse downloaded on my computer with the CDT plugin and i have also downloaded Mingw and set it to my path. When i build my simple "Hello world" program it does create a debug file with the makefile and everything in it but the concle dialog states
**** Build of configuration Debug for project C_Test ****
make all
`Cannot run program "make" (in directory "C:\Users\Chmoder\workspace\C_Test\Debug"): CreateProcess error=2, The system cannot find the file specified
Error: Program "make" is not found in PATH
PATH=[C:\Users\Chmoder\Downloads\eclipse;C:\MINGW\Bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\ATI Stream\bin\x86_64;C:\Program Files (x86)\ATI Stream\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;c:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;c:\Program Files (x86)\Common Files\Roxio Shared\12.0\DLLShared\;C:\Program Files (x86)\Windows Live\Shared]`
Also, when i try to run my program after building it, it says
"Binary not found"
any help people?

Another solution is to set the MINGW_HOME variable in eclipse.ini :
-DMINGW_HOME=C:\Program Files (x86)\CodeBlocks\MinGW
This avoid to change the system PATH (often requires administrator rights)
(solution suggested by help of eclipse / CDT)

The error is: there is no make in %PATH. Make is UNIX utility to help building a projects. For windows OS, the make utility is part of msys, not of mingw32.
According to your path and to my setup of mingw and msys, you have no msys installed (or the path of Msys was not recorded in system %PATH variable).
For you, msys will be like this path in $PATH variable:
C:\MINGW\msys\1.0\Bin;
Msys can be downloaded from http://www.mingw.org/ too.
If you did a download of universal installer (it is the easiest variant), you just should check, is there a make.exe file in the C:\MINGW\msys\1.0\Bin directory and add this directory to the system PATH variable.

For me (on OS X), even though my personal environment (i.e. if in bash, echo $PATH) had /Developer/usr/bin in it, I still had to add it to Eclipse's Environment variables:
Go to Eclipse Preferences -> C/C++ -> Environment -> Add.. -> "${PATH}:/Developer/usr/bin
In the case of cygwin, you'd just put the right directory to where make is.
This was confusing for me, so figured share the details that helped me. :)
source: eclipse forum post via Adel on another SO post.

Goto "Window"->"Prefenerces"->"C++"->"Build"->"Environment"
add "COMMAND"="c:\mingw\bin\make.exe"`.
on the other side, you need a batch file "c:\mingw\bin\rm.bat"
In that file, put:
#echo off
:start
if "%1" == "" goto end
if "%1" == "-f" goto loop
del %1
:loop
shift
goto start
:end

I had the same problem with eclipse Luna version.
I could not even compile the "Hello World" example that comes embedded in the IDE. It kept saying that make file was not found in the path even though it was.
I tried every suggestion in this forum (making sure the path was in Windows and Eclipse variables, and making the rm.bat file) but nothing helped.
What I did is that I copied make.exe from C:\MINGW\msys\1.0\Bin and paste it into the folder where eclipse.exe resides. This might not be the optimal solution but it solved it.

Related

I can't find /rootfs on Windows 10

I'm very confused with the whole WSL situation. Sometimes I feel like I get it but in reality, I don't. My main confusion is where does Ubuntu (I use Ubuntu 20.04) save files? And how do they intertwine with files I install with Windows Command Line? All installations I have done via Ubuntu have been a waste of time, I can't find packages or libraries I install for any programming language. If someone knows of a course or video that could help me understand, I would appreciate it if you share it as well.
The specific situation of this question is caused because I installed a package for C with Ubuntu (the cs50 one) but I can't get VS Code to recognize it. I tried adding /usr/local path to the c_cpp_properties.json but it doesn't find this path.
I go to this folder in the explorer and I don't find anything, as expected.
Thanks in advance.
The file ext4.vhdx is the complete filesystem for the Linux subsystem. However, you can't (or shouldn't) access it directly from Windows 10.
Instead (within the Linux subsystem) you can access your C: drive through mount point /mnt/c (E.g. ls -l /mnt/c/Users ), and that way copy files between the two file systems.
If you want to user Windows explorer (again within the Linux subsystem), use following command:
/mnt/c/Windows/explorer.exe .
Just found out. You can access the files directly from Windows 10. E.g:
dir \\wsl$\Ubuntu-20.04\home
I faced the same problem. I was trying to reach rootfs but couldn't and as you have shown, I was reaching a dead end at "ext4.vhdx". After looking at articles, I found the home directory is found within the Linux subsystem, and to reach there you can use the following path to Linux and go to Linux > Ubuntu > home > user/admin and you'll be in your home directory.
You can directly type \\\\wsl$ in the directory path and then you can see the below image to access the file directory of ubuntu.
File Directory
Then, You can navigate here to see all the files as same as rootfs.`
\Ubuntu-22.04\home\user-name
`
I had the same issue and this is how I figured it out:
first, open PowerShell and type: wsl -d Ubuntu
then, go to your file explorer and type: \\wsl$
this will open the Ubuntu folder and you can access all your files

Code execution cannot proceed because libquickmail-0.dll was not found?

I was looking for a quick and easy way to automatically send a file to my gmail for debugging purposes on multiple remote machines. However I am apparently having linking issues which I can't seem to solve.
I downloaded the win64 zip file of libquick, IDE is CodeBlocks, compile target is x64 and running on 64-bit Windows 10.
There were 10 files that came in the zip folder, in lib/include/bin. They were
bin > libquickmail-0.dll, libquickmaillight-0.dll, quickmaillight.exe.
include > quickmail.h.
lib > libquickmail.a, libquickmail.dll.a, libquickmail.la, libquickmaillight.a, libquickmaillight.dll.a, libquickmaillight.la.
I linked to all of the .a/.dll.a/.la and .dll files and it still gives me this error: Code execution cannot proceed because libquickmail-0.dll was not found
I have no idea what the problem is and am very open to ideas. Thank you for your time.
Either copy the libquickmail-0.dll to the same directory as your linked executable or add the libquickmail bin directory to your path. This will allow Windows to find the DLL to run the executable.

Compile C source file using Command Prompt

I am having trouble while using the codeblocks-16.01mingw-setup.exe - installed in a file whose path does not contain spaces - when trying to compile at a comand prompt. A beginner's guide recommended using the following line in command prompt:
gcc cards.c -o cards
for the source file named cards.c (on my desktop). This gives the error
'gcc' is not recognised as an internal or external command, operable program or batch file.
When trying to figure this out, I have found out that you can drag and drop files in your command prompt and it specifies their path. Doing this with the gcc.exe taken from F:\Programare\Codeblocks\MinGW\bin\gcc.exe and adding the c source file as C:\Users\dream\Desktop\cards.c gives the error
as.exe - System error: The program can't start because libintl-8.dll is missing from your computer. Try reinstalling the program to fix this problem.
I've reinstated my Codeblocks to no avail. I've also tried matching the paths of the compiler with the source file, bringing the source code where the compiler was, again to no avail.
Please help me understand the issue. I must say that the file named libintl-8.dll is right there where gcc.exe is, trying to add it in the command prompt gives some syntax error.
gcc is trying to find that dll file in the working directory, so you need to cd into that directory cd /d F:\Programare\Codeblocks\MinGW\bin.
Dynamic-Link Library Search Order (Windows)
The directory specified by lpFileName.
The system directory. Use the GetSystemDirectory function to get the path of this directory.
The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The current directory.
The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key. The App Paths key is not used when computing the DLL search path.
You have to add F:\Programare\Codeblocks\MinGW\bin\ to your users or systems PATH environment variable.
Once you have done this you can simply type
gcc cards.c -o cards

Executable built with VS2010 does not find DLLs in System32

I recently built a project on VisualStudio. I got an executable in the bin folder and I put all the dependencies x64 DLL in C:\Windows\System32 and all the x32 DLL in C:\Windows\SysWOW64
When I execute my executable, I get an error message This program can't start because foo.dll is missing from your computer.
I tried to get the dependencies with ldd.exe on Cygwin, but I don't see any references to foo.dll. I also tried to execute from PowerShell Start-Process -PassThru sample.exe, but I still get the same error message.
Where does Windows executables look for DLLs?
I've read that a Windows executable will look for its dependencies in a certain order:
In the local folder
In System32
In the %PATH%
I also read that I may need to use regsvr32.exe to register my DLL if it is located into System32.
What is the actual reality of this story?
Alternatively, you can simply add the DLL files to the bin folder as well.

Simple way to execute C program without IDE

I am new to C. What is the most simple way to execute a C program without an IDE?
I created my first C program und it runs flawlessly using my IDE Netbeans on Mac OS X. Now I need to make that program be "executable without IDE on Windows".
Also the requirement is only "Windows", no specific version. Which means I might have to support XP, Vista, 7, 8.
What is the most simple way to do so?
As soon as you have built your app, it is a program you can run outside the IDE. You just need to find it. :) In NetBeans this will usually be under your project directory in a subdirectory called "dist". There will be an executable file in there which you can copy out to wherever you want.
Download MinGW here: http://sourceforge.net/projects/mingw/files/latest/download?source=files
and install it.
Then go to cmd (In Windows 8 - Windows key+R and type cmd in the window opened. In Windows 7 - search >> run >> cmd).
After installing it and entering cmd type in the Command Prompt window (CMD) cd C:/MinGW/bin (when MinGW is on C drive which is the default path). After doing so type the following command: gcc -o X.exe Y.c when X is the name of the output file (what name you want the .exe file to be and Y is the name of the C file that must be inside of the BIN folder (C:/MinGW/bin by default). It should be compiled smoothly if it compiled in your IDE and then the .exe file would be in the BIN folder named X.exe (when X is what you typed in the CMD). Afterwards, you can close your CMD and do with the .exe file whatever you like.

Resources