How to reproduce #include_next compile time error? [duplicate] - c++

This question already has answers here:
Error compiling OpenCV, fatal error: stdlib.h: No such file or directory
(5 answers)
Closed 2 years ago.
I have a library that could be compile on windows, And now i need to compile on WSL (Debian 9.5). But i get a confusing compile error:
/usr/include/c++/6/cstdlib:74:15
#include_next <stdlib.h>
No such file or directory.
I try to change INCLUDEPATH variable (which i use QMake) but that make no sens. And i couldn't reproduce this error message on another project. How this could be happened ? and how could fix it ?
Specification:
- OS: Debian 9.5 on WSL (Windows 10)
- Compiler: GCC 6.3.0
- C++ Standard: C++17
- Include Paths: /usr/include | /usr/local/include | /usr/include/c++/6/

I think the answer is on another answer here.
Which is to disable precompiled headers.
-DENABLE_PRECOMPILED_HEADERS=OFF

Related

Cmake : /bigobj: No such file or directory [duplicate]

This question already has answers here:
GCC equivalent of MS's /bigobj
(5 answers)
Closed 1 year ago.
When I was building an application of mine which used Assimp, I got an error
C:\Users\nitin\AppData\Local\Temp\ccA4Vs3q.s: Assembler messages:
C:\Users\nitin\AppData\Local\Temp\ccA4Vs3q.s: Fatal error: can't write 117 bytes to section .text of CMakeFiles\assimp.dir\AssetLib\IFC\IFCReaderGen1_2x3.cpp.obj because: 'File too big'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/as.exe: CMakeFiles\assimp.dir\AssetLib\IFC\IFCReaderGen1_2x3.cpp.obj: too many sections (46774)
C:\Users\nitin\AppData\Local\Temp\ccA4Vs3q.s: Fatal error: can't close CMakeFiles\assimp.dir\AssetLib\IFC\IFCReaderGen1_2x3.cpp.obj: File too big
Nade\vendor\assimp\code\CMakeFiles\assimp.dir\build.make:1965: recipe for target 'Nade/vendor/assimp/code/CMakeFiles/assimp.dir/AssetLib/IFC/IFCReaderGen1_2x3.cpp.obj' failed
So I searched online for solutions and I found a solution that said that I need to set the /bigobj flag.
I am using Cmake and Mingw32-make.
But when I add the definition like this
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} /bigobj)
or like that
add_definitions(/bigobj)
I Get the error
/bigobj: No such file or directory
How do I solve this error while solving the Too Big OBJ file error at the same time?
The /bigobj option is for Microsoft Visual Studio compiler.
For GCC, try -Wa,-mbig-obj instead.
If you want to support both, try:
if (MSVC)
add_compile_options(/bigobj)
else ()
add_compile_options(-Wa,-mbig-obj)
endif ()
If you want to specify directly only a single target:
target_compile_options(my_target_name PRIVATE /bigobj)

Filesystems undefined reference [duplicate]

This question already has answers here:
how to use std::filesystem on gcc 8?
(3 answers)
'std::filesystem' has not been declared after including <experimental/filesystem>
(3 answers)
Closed 1 year ago.
I having problem with filesystems library. I have seen many solutions from SO and multiple other forums, but none of them works for me. (I will add list most of them bellow)
System specs:
WSL - Ubuntu 18.04 on Windows 10 build 19041
G++:
g++-8 (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
Linker error:
the message is prety chaotic so I will show just the important parts of error message and the complete error message will be bellow.
undefined reference `std::experimental::filesystem::v1::file_size(...)
undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()
From what I see the header file is here, but the source file with definitons is not included.
I have tried:
Adding -lstdc++fs along with -std=c++17
Using both #include <filesystems> and #include <experimental/filesystems> - in first case it doesn't even see the header file of the lib. I even tried some other -std=... flags that I can't name right now.
The complete error: https://pastebin.com/HuePgrMw

wchar.h no such file or directory

I've been trying to run simple c++ program
#include<iostream.h>
void main(){
cout<<"helloworld";
}
and the error I get is :
In file included from d:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\postypes.h:40:0,
from d:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iosfwd:40,
from d:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:38,
from d:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
from d:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iostream:39,
from my.cpp:1:
d:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cwchar:44:19: fatal error: wchar.h: No such file or directory
#include <wchar.h>
^
compilation terminated."
anyone know how to fix it ,I'm using the mingw to compile it.
Probably your MinGW is broken. Also, GCC 6.3.0 is very old.
Try a more recent MinGW or even better MinGW-w64.
A standalone build is available from http://winlibs.com/ with GCC 10.2.0 (both for Windows 32-bit and 64-bit).

How to install nan.h on cygwin for g++?

I can't build this simple program on cygwin:
#include <nan.h>
int main(){}
I get this error message:
$ g++ a.cpp
a.cpp:1:17: fatal error: nan.h: No such file or directory
compilation terminated.
Is it possible to install something on cygwin to get correct nan.h?
nan.h is an obsolete include of old gcc. On Cygwin NAN is defined on math.h
You can not use a software written in 2008
https://boutell.com/fracster-src/doubledouble/doubledouble.html
for such specific issue and just hope than it works out of the box.
You need to figure out where nan.h is located and than Add this path to the includes.
How to make g++ search for header files in a specific directory?

c++: compile with library argument in xcode [duplicate]

This question already has answers here:
xcode library not found
(14 answers)
Adding Linker Flags in Xcode
(3 answers)
Closed 8 years ago.
In terminal, this works:
g++ -lgmp main.cpp
while this does not:
g++ main.cpp
I am using X-code as my IDE and how could I tell X-code to add the statement '-lgmp' when compiling? Thank you:)
Edit: I did according to the article providing the answer:
but I still fail:
and this is the error message:
More information:
I have to use c++98 instead of c++11 because one of my package Gurobi requires that. Do you know any solution? thank you:)