How to add sys/mman.h to MinGW in Windows? - c++

I'm trying to use the following tool: Extract Loudest Section in Windows.
I used the following command line to run main.cc g++ -o main main.cc
But I've got this message: "fatal error: sys/mman.h: No such file or directory"
However, I read this answer, but I still need more details about how to add the needed files correctly to my compiler?
The "Downloads" page in the link provided by the answer shows:
There was an error getting resource 'downloads':
401: Anonymous caller does not have storage.objects.get access to google-code-archive/v2/code.google.com/mman-win32/downloads-page-1.json.
So, I found this as an alternative resource.

Related

fatal error: 'ext/hash_map.h' file not found on Mac

I run some downloaded code using hash_map.h. But when I compile it using g++, it gives error message:
fatal error: 'hash_map.h' file not found
I search on google, some one suggests to replace 'hash_map.h' by 'ext/hash_map.h' and add 'using namespace __gnu_cxx;'. But still I get the error message 'fatal error: 'ext/hash_map.h' file not found'.
I type "sudo find / -name hash_map.h" in the terminal of my Mac, and get the following results.
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/c++/4.2.1/backward/hash_map.h
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/c++/4.2.1/debug/hash_map.h
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include/c++/4.2.1/backward/hash_map.h
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include/c++/4.2.1/debug/hash_map.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/c++/4.2.1/backward/hash_map.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/c++/4.2.1/debug/hash_map.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/c++/4.2.1/backward/hash_map.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/c++/4.2.1/debug/hash_map.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1/backward/hash_map.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1/debug/hash_map.h
How to link hash_map.h to the downloaded code?
I add the path to the hash_map.h to the Makefile as follows.
g++ -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1/ -c target.cpp
And I replace 'hash_map.h' by 'debug/hash_map.h', and add 'using namespace __gnu_cxx;'.
It works for me.

Permission Error when Compiling C++ code in Cygwin

I'm trying to compile a file in C++ on Cygwin but I keep getting the same error:
Hola! ~/projects/basic-cpp $ g++ main.cpp
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: reopening a.exe: Permission denied
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: final link failed: Permission denied
collect2.exe: error: ld returned 1 exit status
I've seen on other questions on Stack Overflow that this can be caused by the executable being currently run, but I know this is not the case. If I run the command with raised permissions it compiles, so it has something to do with not being able to create the file in the directory because it doesn't have permission.
Also, when I get it to compile by using raised permissions, the file isn't writable by the user. If I compile something using java the *.class file isn't user writable either. If I open and save a new file with emacs the file IS user writable. I feel like there's some serious permission issues with my Cygwin install and any pointers would be helpful.
I had to fully reinstall Cygwin in order to fix this. Something was seriously wrong. I'm still not sure what caused it.

Compiling DISLIN gfortran

I am having trouble compiling Fortran code with references to DISLIN. I have downloaded DISLIN from the website, unzipped the file and ran the setup. I have added an environment variable called DISLIN (C:\dislin) and added C:\dislin\win to the PATH section of my system variables.
I am trying to compile some example code of the DISLIN website which includes line
USE DISLIN
I am using a MinGW shell to compile with command gfortran -o progrname -ldislin EX11_1.f90 and am getting the following error:
Fatal Error: Cant open module file 'dislin.mod' for reading at (1): No such file or directory.
I have tried changing the variable path and even moving the dislin.mod file (which is there) but still get the same message.
Ok I fixed this problem so thought I come back and post what worked for me incase any one else needs it...
Install both DISLIN and MinGW on the c drive
Copy disgf.a from /c/dislin and dislin.f90 from /c/dislin/gf into the directory containing your fortran files
(for me this is /c/MinGW/pnote)
Using the MinGW shell navigate to you files: cd /c/MinGW/pnote
compile dislin.f90 and your fortran program: gfortran -c dislin.f90 progName.f90 (dislin.f90 obviously only needs to be done once)
link libraries etc and compile: gfortran progName.o disgf.a -luser32 -lgdi32 -lopengl32 -o exeName
'run' exeName
You probably need to specify the path to the DISLIN module files:
gfortran EX11_1.f90 -o progrname -ldislin -I/path/to/DISLIN/modules
and, if not already configured like described here, also the path to the library itself:
gfortran EX11_1.f90 -o progrname -ldislin -I/path/to/DISLIN/modules \
-L/path/to/DISLIN/library
They provide a batch file (windows) to do the compiling and linking for you.
f90link -c My_Program
This is located in c:\dislin\Win
Also, if you are having trouble with the dislin.mod file which resides in c:\dislin\gf then recompile that with the -c compile option. I found all of this info in c:\dislin\readme.inf
near as I can tell (Jan 2018) dislin (64 bit) fails miserably with gfortran 7.2, period; and probably with many other newer compilers.
When trying to link, gfortran 7 says 'dislin.mod' is an unrecognizable format.
I think this program is highly dependent on exactly correct version synchronization - something that renders such software useless imho after many years in research.
and no, the correctness of various 'paths' seems not to help.
after all, gnuplot works, "at all". Not sure why I spent so much time on brand x.
jrc

How to get started with twitCurl?

I am trying to use twitCurl and I am following instructions given on
[1]: http://code.google.com/p/twitcurl/wiki/WikiHowToUseTwitcurlLibrary under the Unix/Linux section.
Getting stuck while doing
g++ twitterClient.cpp -ltwitcurl
It gives an error message
In file included from twitterClient.h:4:0,
from twitterClient.cpp:1:
includes/twitcurl.h:8:23: fatal error: curl/curl.h: No such file or directory
compilation terminated.
The file curl.h is inside curl/ but it still gives an error.
Why?
Add -I<path to curl/curl.h> to your building command.

Displaying info in the eclipse console

I'm trying to compile a C++ project (Hello World) in windows 7 using Eclipse Helios. After creating the project the console shows me the next message:
Internal Builder is used for build **
g++ -O0 -g3 -Wall -c -fmessage-length=0 -osrc\hello.o ..\src\hello.cpp
g++ -ohello.exe src\hello.o
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe:
warning: auto-importing has been activated without --enable-auto-import specified on the command line.
If I open the command line and execute: g++ hello.cpp -Wl,-enable-auto-import, I can generate the exe file and I can run it.
In eclipse after adding the argument "-Wl,--enable-auto-import" in the MinGW C++ Linker - Miscellaneous section, I didn't get any warning however, the console is always empty. Again, using the command line, if I move to the directory and execute the exe file generated by eclipse I get the expected result.
I know that Eclipse is compiling the cpp file properly but, why the eclipse console is not displaying the info? Is something missing in the configuration?
Sorry guys my stupid question.
I appreciate your help.
This looks like an environment variable(s) and/or register paths problem.