Code::Blocks

User forums => General (but related to Code::Blocks) => Topic started by: Rossati on September 13, 2019, 10:21:40 am

Title: Include regex.h
Post by: Rossati on September 13, 2019, 10:21:40 am
Hi
I am using Code::Block 17.2 on windows 10 and I can't include <regex.h>.
I tried to add this search directory C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++ but this is not working.

Thanks
Title: Re: Include regex.h
Post by: Miguel Gimenez on September 13, 2019, 10:28:09 am
You must include <regex>, not <regex.h>
Title: Re: Include regex.h
Post by: Rossati on September 13, 2019, 12:03:29 pm
Thanks Miguel
Unfortunately I have tried also
Quote
#include <regex>
, but the result is always
Quote
... fatal error: regex: No such file or directory|
best regards
Title: Re: Include regex.h
Post by: Miguel Gimenez on September 13, 2019, 12:30:39 pm
Then post a full rebuild log:

http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F
Title: Re: Include regex.h
Post by: Rossati on September 13, 2019, 03:14:10 pm
I am running Code::Blocks version 17.12 on Windows 10

Build log:
Code: [Select]

-------------- Build file: "no target" in "no project" (compiler: unknown)---------------

mingw32-gcc.exe  -I"C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++\bits" -c C:\Sviluppo\fGenTK\C\re.c -o C:\Sviluppo\fGenTK\C\re.o
mingw32-g++.exe  -o C:\Sviluppo\fGenTK\C\re.exe C:\Sviluppo\fGenTK\C\re.o   
C:\Sviluppo\fGenTK\C\re.c:4:17: fatal error: regex: No such file or directory
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 

I have already tried ...
#include <bits/regex.h>
... but none of them worked.
Title: Re: Include regex.h
Post by: Miguel Gimenez on September 13, 2019, 04:22:55 pm
TDM 5.1.0 may have no regex, is there a regex file (with no extension) here?

Code: [Select]
C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++

If so, that's the path you must add as search directory. If not so, update MinGW to a newer version.
Title: Re: Include regex.h
Post by: stahta01 on September 13, 2019, 06:10:41 pm
I suggest either using a Code::Blocks project or finding another IDE.
C::B is designed to use C::B projects; it does a very poor job when not using C::B projects.

http://wiki.codeblocks.org/index.php/Creating_a_new_project (http://wiki.codeblocks.org/index.php/Creating_a_new_project)

Tim S.
Title: Re: Include regex.h
Post by: oBFusCATed on September 13, 2019, 07:32:50 pm
@stahta01: Why suggest something that is not helpful? The current problem is not related to the use of projects! Read below for details.

@Rossati: Please rename your file to have .cpp as extension. You're currently using .c which means you're compiling in C mode and not in C++ mode! After that if you have problems with the missing header then you'll need to update your compiler because it might not be available in this version of GCC!

Also next time you could read our FAQ. This problem is specifically addressed there!
Title: Re: Include regex.h
Post by: Rossati on September 14, 2019, 09:23:58 am
Thanks to all

These suggestions have been useful to me:
Unfortunately, an example of using regular expressions that I try to compile, gives me many errors, but this is only my problem.

Best regards