Cannot compile with ansicon
sofronas opened this issue · 6 comments
I have installed ansicon via [(https://github.com/mcandre/ansicon-win)] because i couldn't figure out how to install it manually.
The problem is that i have installed the MinGW in my Windows 10 Microsoft Windows [Version 10.0.16299.192] and i cannot use any command in order to gcc or either run.
I am writing code and i wanna use ansi color displaying in the cmd or powershell window.
Like using an linux environment via unix terminal.
Any way how to figure out?
Thanks in advance!
That is an old version, remove it. The current version has bugs (which I hope to get to in the next few days), but even so I would recommend using it, but not installing it. Just run ansicon
(which starts a new cmd
) or ansicon powershell
and you should be good to go.
Thanks for replying me!
I would like to ask how to run ansicon my program in order to have the same output like i would had if i was running the program in a unix terminal. In the code provided there is no anywhere a .exe file in order to run.
Here is the code i wanna run:
#include <stdio.h> #define RED "\x1B[34m" int main(void) { printf(RED" Red\n"); return 0; }
T:\>cat test.c
#include <stdio.h>
#define RED "\x1B[34m"
int main(void)
{
printf(RED" Red\n");
return 0;
}
T:\>gcc -Wall -O2 test.c -s -o test.exe
T:\>test
←[34m Red
T:\>ansicon test
Red
T:\>ansicon
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
T:\>test
Red
Although 34 is blue...
Maybe i skipped something .. or i am doing something wrong...
I did the same way like you show but its stops working.
I have not installed ansicon.
Here is a link of my screenshot : http://prntscr.com/iaqot5
Thanks in advance for your time.
Are you really using the latest version (confirm with ansicon --version
)? You'll find binaries in the releases or on my site. You could even build it yourself - here's mingw-w64 in a virtual 10:
C:\Users\Jason\ansicon>ver
Microsoft Windows [Version 10.0.15063]
C:\Users\Jason\ansicon>gcc --version
gcc (Rev1, Built by MSYS2 project) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\Users\Jason\ansicon>make -f makefile.gcc
mkdir x64
ansicon.c
injdll.c
proctype.c
util.c
procrva.c
ansicon.rc
x64/ansicon.exe
ANSI.c
ansi.rc
x64/ANSI64.dll
C:\Users\Jason\ansicon>x64\ansicon --version
ANSICON (64-bit) version 1.81 (28 December, 2017).
C:\Users\Jason\ansicon>gcc -Wall -O2 test.c -s -o test.exe
C:\Users\Jason\ansicon>x64\ansicon test
Red
Thanks a lot! Now it worked for me!