Problem to run a plugin to gcc in Windows 10 - c++

Im working in Windows 10 OS. I want to run a simple gcc plugin, so first i installed Mingw. Then I compile a simple hellowrd.c and works fine. But when I tried to simulate a plugin that uses "gcc-pugin.h" include, an error ocurrs because gcc-plugin.h "no such file or directory".
Apparently the mingw installation did not install everything I need.
Is it a problem that Windows does not work?
#include "gcc-plugin.h"
#include "plugin-version.h"
...

That means wherever that header file is, it was not found in the default include directory. You can try typing the full path to the .h file in the #include directive.

Related

wxWidgets with MinGW, "wx/wx.h: No such file or directory"

I am new to C++ and wxWidgets. During the last couple of days, I have followed a tutorial with Visual Studio into how to build wxWidgets desktop applications (https://www.youtube.com/watch?v=FOIbK4bJKS8&t=800s).
Now, because I am not familiar with Visual Studio, I wanted to move to edit the code with Atom and compile with MinGW from Windows command prompt.
The app has the following files:
cMake.h
AnalogRead.h
cMake.cpp
AnalogRead.cpp
In Visual Studio, you need to include two directories and one library in the project, which are the following:
Paths:
/wxWidgets/include
/wxWidgets/include/msvc
Libraries:
/wxWidgets/lib/vc_lib
Relative to the path where the the C++ code is.
So I have tried to create the compile line, without success:
c++ -I/wxWidgets/include -I/wxWidgets/include/msvc -L/wxWidgets/lib/vc_lib cMake.cpp AnalogRead.cpp -o test
But I get the following error:
In file included from AnalogRead.cpp:1:0:
AnalogRead.h:3:19: fatal error: wx/wx.h: No such file or directory
#include <wx/wx.h>
^
compilation terminated.
The thing is, I am including that path in the compilation. wx/wx.h is inside the path /wxWidgets/include/.
Is there a way to fix this? Thanks in advance.
You can't compile the library with one compiler and then compile the application using it with another, this is just not going to work. You should decide which compiler you want to use (or maybe try using both of them, but not both at the same time!) and follow the official build instructions in the file docs/msw/install.md.
/wxWidgets/include is not a relative path. This is an absolute path in the current disk. Do you have C:\wxWidgets\include? Try -IwxWidgets/include or -I./wxWidgets/include, without the leading /. This path should work if you have the wxWidgets directory in your app sources.
If you want to use MinGW, you need to build the library with MinGW compiler and then use EXACTLY THE SAME command to buid your software.
Or use an IDE (CodeBlocks, CodeLite).
HTH.

cygwin1.dll is missing - Cannot run program

I wrote a program in C/C++ and compiled it using Cygwin. When I ran the compiled file, I receive an error about a missing library.
Cygwin is like a simple framework: With every program you build you have to include the library cygwin1.dll.
Important note: Downloading the library online might be risky as it can be a virus.
To fix the issue:
1. Go to your cygwin directory. Usually that is C:\cygwin or C:\cygwin64.
If you don't know where cygwin is, download the setup file and run it. The installation path the installer suggests is the Cygwin installation location.
Tip: Don't use a directory to put cygwin in that includes spaces (" ") as it will be easier to run programs with command-line parameters.
2. Copy the file. It should be in <Drive>:\cygwin\bin\cygwin1.dll.
3. Copy the file to your program folder, the same directory as your exe file.
Your program should run without throwing an exception.

How to solve Unresolved inclusion: <iostream> in eclipse?

I built a simple program in eclipse:
#include <iostream>
using namespace std;
int main()
{
cout << "TEST" << endl;
return 0;
}
It worked in Visual Studio and CodeBlocks, but eclipse is acting weird. it says:
Unresolved inclusion: <iostream>
I read here:
C++ - Unresolved inclusion: <iostream>
and here: Unresolved <iostream> in Eclipse, Ubuntu
and neither of them worked.
Here are screenshots of project properties:
edit:
I downloaded MinGW and now i have this under Settings:
How should i proceed?
Maybe now i don't need #include <iostream> because it's now included in the project?
I found iostream under Includes.
So i tried deleting #include <iostream>, but when i try to run the program i get:
Launch Failed. Binary not found. error:
Thanks
edit:
Seems like if i compile in some other program (say CodeBlocks) and create the exe file, then eclipse can run it. But it can't build its own exe.
Why?
This answer did not help me either. My issue was solved with the following steps:
You might try changing your source files from *.c to *.cpp. This will provoke gcc to think of the files as C++ and search the proper paths. Might need to make small modifications to the Makefile as well, like on the OBJ: line. Instead of:
OBJS = YourFile.o
try
OBJS = YourFile.cpp
I've searched for a few hours and tried a lot solutions.
Envirment: windows, Eclipse IDE for C/C++ Developers
Version: Kepler Service Release 2
CDT: 8.3.0
Following steps works for me:
make sure the envirement is clear. => I suggest delete the eclipse and unzip it again from your orginal download.
make sure the workspace is clear. => Delete .metadata folder in your workspace folder.
use valid MinGW. => the one using download tool is slow and I'm not sure which one to select. I suggest download MinGWStudio from http://vaultec.mbnet.fi/mingwstudio.php
This is a IDE tool like eclipse contains a downloaded unzip MinGW. Make sure you download the one plus MinGW compiler which is about 20M. You can use this studio if you want or copy the MinGW folder to C:/ if you still prefer eclipse. Copy /MinGW inside /MinGWStudio to C:/.
close your eclipse and reopen it, create a new project, you should able to see MinGW section for new project option, and it will auto map g++, gcc and include files under C:/MinGW folder. Just make sure you copy MinGW folder from MinGWStudio to the root of C:/.
You will able to see your include after these steps.
includes_screen_cast
right click your project click properties goto C/C++ Build > settings click on Misc. under GCC C++ Compiler and the other flags code should have this after it -std=c++11 then go to Misc. under GCC C Compiler and add this to the other flags code -std=gnu11 apply save your project build your project and it should work

How to fix turbo c++ error "Cannot open include file: graphics.h: no such files or director"

I had been using turbo c++ compiler in windows xp but i have installed windows 7 yesterday and now i am having a small problem, turbo c++ is not working in window 7 ultimate 64bit. It say "Cannot open include file: graphics.h: no such files or directory" when i wanna include header file.
Check your include directory settings and make sure they are referring to the right location and graphics.h is in that location. I am assuming you are using
#include <graphics.h>
rather than
#include "graphics.h"
I'm not sure the code will need to change (as it was compiling before presumably) but more you need to add some folders to the system include paths.
I am also curious as to why you'd be using TurboC++. I'm still using VC6 at work and I consider that ancient!

libgmp-10.dll is missing

I recently installed MinGW on my 64-bit Windows 7 computer and when I attempt to compile the most basic of c++ programs, for example
#include<iostream>
using namespace std;
int main()
{
cout << "Hello World" << endl;
return 0;
}
I get the error that "The program can't start because libgmp-10.dll is missing from your computer."
Have you tried adding C:\MinGW\bin as a System variable Path (not PATH) in Settings->System Properties->Environment Variables?
I saw this solution on this page: Missing libgmp-10.dll
Go to the mingw download page and browse the following directories:
MinGW / Base / gmp / gmp-5.0.1-1
Currently you end up with the following link:
http://sourceforge.net/projects/mingw/files/MinGW/Base/gmp/gmp-5.0.1-1/libgmp-5.0.1-1-mingw32-dll-10.tar.lzma/download
and it contains the needed file.
I know there are automated methods for installing mingw gcc, but when one uses single mingw packages, then gmp is one of obligatory downloads.
added
c:/MinGW/bin to PATH
and restarted CMake-gui
worked for me
I came upon this question when I started CodeBlocks and then clicked on my project. After the project notes appeared and I pressed OK, the error appeared:
"System Error: The program can't start because libgmp-10.dll is missing from your computer.
Please reinstall the application to fix this problem."
I presse OK a bunch of times and then was able to do normal compile, link, etc. but that error showed up everytime I started C::B and went to the project. Then I noticed that the LLVM Clang compiler was my default compiler in the compiler settings, though GCC was set as the compiler specific to the project I was working on.
The solution was to set the compiler in the compiler settings to GCC (mingw) and also set it as the default compiler. After that this system error stopped popping up every time I started the project.
The reason I posted this answer is because it answers the OP's question and other people with the same question may have a similar reason for this irritation, and my personal experience in this matter may prove useful to those people.
If you did not find this file in your installation directory, and then went to the site [Click here] to download the file, and then extract it to your installation directory.enjoy:-)
Caution - removing stuff from your path can compromise your system!
Interestingly, you not only need to add the MinGW bin to your Path, but also you need to make sure that certain things are not on your path*. In my case, I saved my entire path variable as a backup, deleted everything non-system from my path except for MinGW and CMake, leaving:
C:\MinGW\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files (x86)\CMake\bin
You should use the appropriate elements from your system path.
I first tried to do this with a batch job that launched CMake, but it seems that the CMake GUI was reaching back and grabbing the System 'Path' variable instead of the command prompt 'Path' variable, which I had printed and confirmed was as listed above before launching CMake.
Incidentally, I backed up the entire Windows VM before starting!
* For instance: various references, including known issues, mention sh.exe. I inherited this VM from my client and hacked it up further, so it's easier for me to use a clean path for my cross-compiling task and return afterward...
In just installed MinGW using the mingw-get-setup.exe v0.6.2beta-20131004-1 installer. Even though during the install I selected the gcc package, the installer didn't include the "mingw32-gmp" package, which includes libgmp-10.dll. I had to rerun the installer, chose the "Reinstall" option, and manually select the "mingw32-gmp dev" package.
If you don't have the permission modifying your global path, you can also change the active directory of your cmd shell.
How to do it (in the cmd shell):
C:\> cd C:\MINGW\bin
C:\MINGW\bin> gpp.exe C:\Users\James\Desktop\Program.cpp
How it doesn't work:
C:\>C:\MINGW\bin\gpp.exe C:\Users\James\Desktop\Program.cpp
Note: you have to change "C:\Users\James\Desktop\Programm.cpp" to wherever your program lays
How it works: windows looks for needed DLLs while in the same directory and if it can't find it there it'll look in the PATH variables (so it will search system32 by default), if you add any missing DLLs to the directory from where you run it, windows looks and uses them (even before it looks in the PATH).
A very simple fix to this problem of having missing driver file/s is to select and copy all the dll files from C:\MinGW\Bin and paste them into your C:\MyPrograms or whereever else your folder for created c++ (.cpp) files are being located.
Just search google for the dll file and download it. Then paste it into the folder in this path
C:\MinGW\libexec\gcc\mingw32\9.2.0