I think you’ve snatched defeat from the jaws of victory here From the discussion above, it looks like you removed the MacPorts installation just before using the correct build command with the correct #include in your source.
You are learning some new concepts at the same time. As you weren’t familiar with using a terminal, communication has been harder and documentation assumes familiarity with using a terminal.
It is recommended that a beginner installs a package on their system using a package manager. You did that initially with MacPorts (you could have used Brew). Unfortunately you went ‘upstream’ to GTK, using gtk-osx-build-setup.sh
. If you go upstream to the source projects, you have to build the project yourself and there is usually more complexity. In this case, the jhbuild
setup was likely not providing you with the environment you expected. I would recommend beginners use package managers if possible.
Also, some general points to help you diagnose issues in other forums if not here. All should be taken constructively.
Don’t assume what is wrong, state what you were trying to achieve. For example you assumed that MacPorts didn’t install gtk.h and most people would think they couldn’t help you. However, MacPorts had installed it and others could have helped as that wasn’t the issue.
If you quote the following in your message:
- source file
- the command you used to build it
- the error message you received
then most people here would likely be able to quickly point out what is wrong. You should include these verbatim. In this discourse forum that is achieved by putting the contents inside triple backtick markers e.g.
```
cc `pkg-config --cflags gtk+-3.0` hello.c -o hello `pkg-config --libs gtk+-3.0`
```
so this markdown renders as
cc `pkg-config --cflags gtk+-3.0` hello.c -o hello `pkg-config --libs gtk+-3.0`
I hope that helps. Good luck in future.