Trying to use Eclipse for c++ project on Mac - c++

I am a total noob at programming and IDEs. I am attempting to open a project for some research that I am doing. I have a Macbook Pro using Mac OS High Sierra 10.13.6.
The project that I'm trying to open is a c++ project, but every time I open it, there are error messages everywhere. It appears that the header files aren't even being recognized. A screenshot is linked below. From what I've read so far, the issue seems to be that I don't have a proper debugger for c++. I downloaded XCode after I downloaded Eclipse like some guides have recommended, but it still hasn't fixed the issue.
Other sources I've found on this site use highly technical language (Eclipse GDB MacOSX Mavericks), so I'm struggling to figure out how to fix the problem. If anyone has any ideas, I'd love to hear them.

Here is a better solution for beginners.
Create a file called HelloWorld.cpp
and copy paste the following inside:
#include <stdio.h>
int main(int argc, char **argv)
{
printf("Hello world\n");
return 0;
}
Then open your terminal ( like that ) and write this:
$ g++ -g -o main HelloWorld.cpp
If this goes smooth it means you have gcc installed (good!).
After that try to run this:
$ gdb ./main
If this goes smooth it means you have gdb installed (great!).
Move to create a new Eclipse project with this file only
and update your post if there are any problems.
If this goes smooth gradually migrate your stuff to HelloWorld.cpp.
If gcc or gdb steps above fail, you have to install them first.
There are many online guides on how to do that. Good luck!

I am by no means a Mac expert or do I know much about eclipse CDT or Xcode but I can offer what I know. This is not a complete answer but I just want to share as I also know what it is like to struggle with C code on OSX.
First,
You need to make sure the C/C++ compilers are installed on the Mac properly. They come with XCode and I believe the compiler is Clang. Then you need to make sure the standard libs were installed correctly.
That whole issue is your first problem and should be asked to an XCode programmer and what not.
Second, to use eclipse CDT you need to tell it where and what compiler you are using. As well as the linked and debugger. You can do this in the project properties or settings. The stuff should usually be put in the path variable but once eclipse CDR knows where to find all that and everything is installed correctly it should pick up the header files and then include them in every project!
That’s all I can really provide you and I hope you can find out more.

Related

VScode says there are include errors when I try to write c++ programs

I haven't been able to compile c++ programs on vscode (or any IDE for that matter) and I can not for the life of my figure out why. This happened after I factory reset my computer due to other issues. Everything was working fine until then. I re-installed gcc through MinGW and checked that it is installed by typing gcc in command prompt. I can even compile programs through command prompt, which proves that gcc is installed. I would much prefer to use code though, and I was wondering if anyone knew why code is complaining about include paths.
Here's an image of the relevant file with the paths
ANY HELP IS GREATLY APPRECIATED!!!
Install C++ extension, you can find more information here:
https://code.visualstudio.com/docs/languages/cpp

Using g++ and ./a.out

Hello everyone I have finally decided to learn to code, even if it is just a hobby, I once picked it up years ago and I am gong through the tutorials on codeacademy, I have a question for everyone.
Tonight I downloaded Codeblocks with Ming compiler, the programs work fine, the ones I have tried to rewrite from memory from my lessons, but I am missing something that became second nature during my lessongs. After writing the code required for the challenge, I would go into a folder with the extension .cpp and add the command g++ temperature.cpp(for example) -o temperature and then once the a.out file was created I would go into that and do the ./temperature command to execute the program.
I like being able to manually compile and than executre my code, and would like to be able to do this in codeblocks. I know it may sound stupid, and I know Codeblocks does it for me, but is there any way, I can do it for myself? Is there any way I can write my code and have the terminal on the right side of the screen like codeacademy has it?
Or should I just forgot about the g++ and ./ commands? I figure that I can do it throug the command prompt but that would require getting to the folder etc, and have not yet fully familiarized myself with the command prompt.
Thank you in advance for the help.
I first commented, then I decided to make it a full answer, since I kind of answered the heart of the question in the comments by accident anyway.
Yes, you can absolutely do this yourself. Using an IDE (Integrated Development Environment) like Codeblocks will make things easier for you, but there is no harm in learning how to do it under the hood if that interests you--especially if you're doing this for a hobby and not a work situation with time constraints.
To understand what g++ is fully capable of, I recommend consulting the official documentation. That will explain how to properly use it better than me and probably anyone else could.
While you're at it, I would also recommend learning how to use make if your platform supports it. It is a tool that can make compiling easier than working with the compiler directly, but offers more control than your IDE might (though this depends on the IDE).
You mentioned that you used the Ming compiler for Codeblocks, so I'm assuming that you're on Windows. To use the g++ command here, you'll have to
Add it to path, in order to make the g++ commands available for you throughout the system. This video explains adding the ming compiler to the path pretty well.
Call the command (from the command prompt, or some other kind of terminal)
You will have to get just the basic commands down for the command prompt, but it's not that daunting. cd to change directory and dir to list directory, and navigate to your project directory in codeblocks.
Finally, keep in mind that because you're on windows, when you compile with g++ you'll get an .exe file. .out files are produced when you compile on linux. If you want to get a linux shell on windows, I'd recommend looking into either Cygwin or WSL.
IDEs make compiling and executing much more convenient, but it's not a bad idea to learn how it all works through the command line. Best of luck!

First time using SFML-2.5.1 in NetBeans IDE 8.2 I ran into the problem

After the setup I've done in the properties of the project: at C++Compiler and Linker in both Release and Debug configurations I tried to build the project, which went successful.
Then I decided to run it and had some difficulties: using External Terminal, that did absolutely nothing, Standard output, that showed some text related to dll files I've clue about, Internal Terminal, that showed the very same text.
After that didn't work I went for cmd execution and what I saw was this.
Could you explain what that means and what I'm supposed to do. I'm new to all that kind of stuff, so I apologise if I did something stupid.
Cheers
EDIT: If not seen, I'm using Windows 10 and the version of SFML is GCC 7.3.0 MinGW (DW2) - 32-bit

OpenCV in Code::Blocks: The application was unable to start correctly (0xc00000be)

I set up OpenCV with Code::Blocks as per this tutorial: http://kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw/.
I've got as far as building the test program at the end successfully, but when I try to run it I get the following error: "The application was unable to start correctly (0xc00000be). Click OK to close the application."
The one thing that is certainly different from the tutorial for me is that I'm working with OpenCV 3.0.0, Code::Blocks 13.12 and the latest version of mingw (number not obvious from their website or the installer).
I found that other people had had this problem in the past, e.g. The application was unable to start correctly (0xc00000be)
However, it has been a long time since that thread was active, I'm working with newer versions of the software and, most importantly, the answer given there didn't help (I compiled openCV with the same mingw that I'm using with Code::Blocks), so I thought this question would be worth asking (sorry if it's not, I'm rather new to this).
Could anybody suggest a fix that might get rid of this error?
A few other things to note:
I didn't download the Code::Blocks that came with mingw as I was advised against it, I got them separately as per the tutorial
I have installed OpenCV and Code::Blocks on my E: drive, though mingw is still on my C:.
I have added both mingw and OpenCV to my PATH variable, and mingw to my Path variable
I have linked the libraries in both the main compiler settings for Code::Blocks and the Build Options of my project.
I'm working from a 64-bit Windows 7 Laptop, but I have done everything 32-bit style as advised in the tutorial.
Thanks in advance!
So, one solution I've found to this problem is to copy all the .dll files from "...\opencv\build\x86\mingw\bin" to the project file (build directory).
Having done that, the project will run fine. This still doesn't (directly) explain why it wont run without those files (at least, several sources including the tutorial imply it should), and so isn't really optimal. I will continue to look for a solution for this so I don't have to clutter every opencv project I make with the .dlls.
However, for anyone simply wanting to get stuck into coding who is having this problem, I recommend that solution.

MinGW GCC and G++ Errors in Eclipse

I'm new to this community and this is my first question. I know many people had had this problem before, but, it seems as if people solved it their own ways and I tried all the solutions I could find in google (and here, respectively), but none of them seem to work for me like it was supposed to. And just to make it clear, I use 32-bit Windows XP. Some versions that may work in 64-bit or newer operating systems may not work on mine.
So I'm very new to C and C++, I started by installing the Eclipse CDT, the moment I found out it did not have a compiler was when I installed MinGW which was bundled with a C compiler, a C++ compiler, and the MinGW Developer's Toolkit (which included MinSys). So after that, I started by creating a new empty C++ project called 'HyScript'. And did these:
I set the environment variables as:
C:\Program Files\Java\jre7\bin;E:\Mark\MinGW\msys\1.0\bin;E:\Mark\MinGW\bin
Then, I restarted eclipse, deleted the old projects, and created a new one with the same name (deleted the old folders) and chose the toolchair, "Cross GCC".
Now I haven't even started writing code, but there are already 4 errors:
Here's the link to the dropbox file
The last thing I did was open up the CMD before going here, and this happened: Here's another link to the dropbox file
I don't understand anymore... What did I do wrong? I set the environment variables right, I supposed. And, after doing some research, I still can't find a proper solution for me. It's been two days now, and this error still hasn't gone away.
You chose wrong toolchair "Cross GCC". Please select "MinGW"
The latest version of G++ can be found here. Please do NOT install it in the default directory but use this:
C:\MinGW
If you still have problems, uninstall everything you did, and watch these video instructions.