Recent

Author Topic: GCC won't work properly (a conflict with FreePascal)  (Read 1744 times)

Integra

  • Newbie
  • Posts: 6
GCC won't work properly (a conflict with FreePascal)
« on: August 28, 2024, 08:53:03 pm »
I needed C, so I've installed MinGW and set the PATH, but gcc doesn't see the included files like stdio.h. I've typed "where gcc" and found out that FreePascal comes with gcc. Apparently my PC is using gcc that comes with it, even though it's not set in the PATH and I don't know how FreePascal's gcc managed to become the default option.

I tried moving MinGW over to FreePascal's directory but that didn't help. "Gcc -v" says:

        #include "..." search starts here:
        End of search list.

And then it adds:

        The following default directories have been omitted from the search path:
        /gcc-2.95/lib/gcc-lib/i386-mingw32/2.95/../../../../include/g++-3
        /gcc-2.95/lib/gcc-lib/i386-mingw32/2.95/../../../../include
        /gcc-2.95/lib/gcc-lib/i386-mingw32/2.95/../../../../i386-mingw32/include
        /gcc-2.95/lib/gcc-lib/i386-mingw32/2.95/include
        /usr/local/i386-mingw32/include
        End of omitted list.
        empty.c:1: No include path in which to find stdio.h

I don't have these default directories anywhere, so it's fine that they're omitted, I guess. But the end result is still that the PATH is ignored.


Can I fix this without uninstalling FreePascal?

tetrastes

  • Hero Member
  • *****
  • Posts: 566
Re: GCC won't work properly (a conflict with FreePascal)
« Reply #1 on: August 28, 2024, 09:24:31 pm »
I needed C, so I've installed MinGW and set the PATH, but gcc doesn't see the included files like stdio.h. I've typed "where gcc" and found out that FreePascal comes with gcc. Apparently my PC is using gcc that comes with it, even though it's not set in the PATH and I don't know how FreePascal's gcc managed to become the default option.
Are you sure? What PATH is shown by SET command?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11818
  • FPC developer.
Re: GCC won't work properly (a conflict with FreePascal)
« Reply #2 on: August 28, 2024, 10:05:18 pm »
Usually the problems come from the fact that both come with own versions of tools.

Easiest is to switch paths when you need either toolchain.

Thaddy

  • Hero Member
  • *****
  • Posts: 15923
  • Censorship about opinions does not belong here.
Re: GCC won't work properly (a conflict with FreePascal)
« Reply #3 on: August 29, 2024, 12:13:02 pm »
Do you really have gcc 2.95 installed? That is very,very,very old (dating from 1999!). That might also be a problem.
I never experience problems with my GNU compilers and FPC compilers.
My gcc version is 14.1, stable major release is 13.1 you would need at least 12.1.
Both current versions of cygwin and mingw should install at least 12.1

It is so old that if it is true, there is likely your problem.
« Last Edit: August 29, 2024, 12:15:54 pm by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

Integra

  • Newbie
  • Posts: 6
Re: GCC won't work properly (a conflict with FreePascal)
« Reply #4 on: August 30, 2024, 08:07:42 pm »
The SET command shows this path: "C:\MinGW\bin". After some googling I've found out that apparently it's best to use this directory, otherwise issues might arise with MinGW.

Do you really have gcc 2.95 installed? That is very,very,very old (dating from 1999!). That might also be a problem.
I've installed MinGW-w64, the GCC whose version is shown is the one that comes with FreePascal. I guess it's really old.

Strangely, GCC seems to work for me with CodeBlocks! It's the only IDE where it works, because you can directly set the paths to everything in the options. I've tried other IDEs like Geany, VSCode, CodeLite, but with no luck, GCC can't find its own libraries. But really, CodeBlocks isn't great for my purposes, I need to be able to use a regular command prompt.

At stackoverflow they've suggested that my MinGW installation is just faulty. I'm going to install the latest MSYS2 this time and see if that works. I'll write in the thread again if it does.

Integra

  • Newbie
  • Posts: 6
Re: GCC won't work properly (a conflict with FreePascal)
« Reply #5 on: August 30, 2024, 08:16:08 pm »
Installing MSYS2 didn't affect anything, as far as I can see.

However, I've renamed gcc.exe in FreePascal's directory to _gcc.exe to "remove" it. And suddenly typing "gcc --version" tells me it's 13.1! And "where gcc" tells me "C:\Mingw\bin". The compiler compiles now, without complaining about missing libraries and files.

So everything is fine now, I just had to remove gcc.exe from FPC.

tetrastes

  • Hero Member
  • *****
  • Posts: 566
Re: GCC won't work properly (a conflict with FreePascal)
« Reply #6 on: August 30, 2024, 11:07:21 pm »
The SET command shows this path: "C:\MinGW\bin".

Is that all? I meant the whole PATH environment.

 

TinyPortal © 2005-2018