0

I am trying to compile with mingw32-make but the following error is displayed:

g++ fitscli.cpp vipsoperations.cpp fits.cpp ConsoleTable.cpp `pkg-config vips-cpp `  -lcfitsio -ltiff -o fitscli
In file included from fitscli.cpp:7:
C:/msys64/ucrt64/include/vips/vips8:35:10: fatal error: glib-object.h: No such file or directory
   35 | #include <glib-object.h>

the makefile is:

all:
    g++ fitscli.cpp vipsoperations.cpp fits.cpp ConsoleTable.cpp `pkg-config vips-cpp `  -lcfitsio -ltiff -o fitscli

And the file is too large so I will show where the error is (line 7 include <vips/vips8>:

#include <iostream>
#include <fstream>
#include <filesystem>
#include <stdint.h>
#include <math.h>
#include "include/cxxopts.hpp"
#include <vips/vips8>
#include "fitsio.h"
#include "include/vipsoperations.h"
#include "include/fits.h"
#include "include/ConsoleTable.h"
#define MAXPIXELS 1e8
using namespace std;
using namespace vips;
void saveheader(string header,string filename);
string histogram(VImage img,int bins);
void report_progress(int showprogress,string message)

I appreciate your Help. Now I am working on windows 11, with Msys UCRT64 and the last I tryed was to reinstall glib2 with pacman -S mingw-w64-ucrt-x86_64-glib2 but it does not work. and the Library is being installed successfully (/ucrt64/include/glib-2.0/glib-object.h)

I tried too many times to fix the glib_object.h path expecting that the command mingw32-make compile and produce a .exe file

  • What does `which g++` print, and what is your [MSYS2 environment](https://www.msys2.org/docs/environments/) (as indicated by magenta text in the terminal prompt; `MSYS` or `UCRT64`)? – HolyBlackCat Dec 28 '22 at 05:29
  • On windows Terminal (powershell): "which" is not recognized as an internal or external command,program or executable batch file. and the MSYS Environment is UCRT64, and is showing this: $ which g++ /ucrt64/bin/g++ – Marco Moreno Dec 28 '22 at 14:16
  • I'm interested in the same terminal you use to run the command. PS uses `where` instead of `which`, I think. – HolyBlackCat Dec 28 '22 at 14:22
  • The `pkg-config` command is wrong, you miss `--cflags` and `--libs`. – HolyBlackCat Dec 28 '22 at 14:23
  • The path looks ok. The next step would be to add the missing flags to `pkg-config` invocation, and if it doesn't help, also add `glib-2.0` in there. If that doesn't help either, also add `-isystem /ucrt64/include/glib-2.0` to the g++ flags. – HolyBlackCat Dec 28 '22 at 15:03
  • Yes the flags were in the initial makefile, but is happening what is in the following link: https://stackoverflow.com/questions/74941262/g-error-unrecognized-command-line-option-cflags-g-error-unrecognized/74941319#74941319 – Marco Moreno Dec 28 '22 at 15:07
  • And I also answered that question. :) – HolyBlackCat Dec 28 '22 at 15:09
  • Yes, you are right is "where" and the outcome is: C:\msys64\ucrt64\bin\g++.exe – Marco Moreno Dec 28 '22 at 15:09

1 Answers1

0

Thank you @HolyBlackCat, your help was accurated.

the makefile must be completed with the flags:

all:
    g++ fitscli.cpp vipsoperations.cpp fits.cpp ConsoleTable.cpp `pkg-config vips-cpp --cflags --libs`  -lcfitsio -ltiff -o fitscli

(note --cflags --libs)

And "mingw32-make" must be executed from Bash

HolyBlackCat
  • 78,603
  • 9
  • 131
  • 207
  • 1
    You're welcome! I didn't suggest executing `mingw32-make` from Bash, and I'm surprised it worked at all. There's another program called just `make`, which always uses bash. – HolyBlackCat Dec 28 '22 at 17:47