I am trying compile he following in octave4.0 in Linux 14.04 :
mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims read_data.cpp
mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims write_data.cpp
The following error crops up :
****mkoctfile: unrecognized argument CFLAGS=-std=c99**
**warning: mkoctfile exited with failure status****
Anyone knows what this means and how to fix this?
You should run a setenv('CFLAGS','-std=c99 -whatever -else') command (inside octave) like, for instance:
setenv('CFLAGS','-std=c99');
mkoctfile --mex file.c
But perhaps you want to add the CFLAGS you already have. Well, I know no elegant way to do this, so I would do it manually with a
mkoctfile -p CFLAGS
And copy-paste the result together with your '-std-c99' option, or set it up in the shell before entering octave with a
~$ CFLAGS=$CFLAGS:"-std-c99" octave
Source: http://octave.1599824.n4.nabble.com/mkoctfile-CFLAGS-not-recognised-td4281373.html
Related
I got these errors trying to execute mingw32-make:
g++: error: unrecognized command-line option '--cflags' g++: error: unrecognized command-line option '--libs'`
The makefile is the following:
all:
g++ fitscli.cpp vipsoperations.cpp fits.cpp ConsoleTable.cpp `pkg-config vips-cpp --cflags --libs` -lcfitsio -ltiff -o fitscli
After some research there was a suggestion to delete '--cflags' and '--libs` from the code, and I did it.
I know is that maybe the compiler g++ is not having able the options '--cflags' and '--libs`
I also tried to change to gcc compiler, but doesn´t work.
I am working on windows 11, with Msys URCT64
When I deleted the lines suggested, is causing another compilation error, so I want to know how to fix the flags issue without deleted them from the code.
Thanks.
The backticks ` ` don't seem to work properly in mingw32-make (because it uses CMD as the shell, which doesn't support them).
Use make instead (install with pacman -S make), which uses Bash.
I'm trying to build this: https://github.com/hselasky/hpsat_generate
this is their makefile:
PROG_CXX=hpsat_generate
PREFIX?=/usr/local
MAN=
SRCS= hpsat_generate.cpp
BINDIR?=${PREFIX}/bin
.if defined(HAVE_DEBUG)
CFLAGS+= -g -O0
.endif
CFLAGS+= -I${PREFIX}/include
LDFLAGS+= -L${PREFIX}/lib -lgmp -lgmpxx
.include <bsd.prog.mk>
using just make . results in
Makefile:7: *** missing separator. Stop.
so after some searching I found that I need to use FreeBSD make, so I tried:
bmake . hpsat_generate
which complains that mergesort is not declared, which is a FreeBSD function so I can only assume it doesn't really includes it.
I tried finding a way to make it run but I'm out of ideas..
The Makefile requires some changes for Linux (and NetBSD). The bsd.prog.mk implementation that comes with bmake on Linux is slightly off, and requires a workaround to link the program correctly, also, on Linux you need libbsd:
These issues are fixed by PR #1.
Instead of running the makefile just execute this:
g++ -o sat sat.cpp -lgmp -lgmpxx -l:libbsd.a
you may need to install the gmp and libbsd libraries
I'm trying to compile C++ on Windows.
The command needed to compile on Linux is:
g++ -O3 -Wall -shared -std=c++11 -fPIC `python -m pybind11 --includes` EO_functions_bipartite.cpp -o extremal_bi.so
I installed MinGW but when I try to compile I get the following error:
g++.exe: error: python: No such file or directory
g++.exe: error: pybind11: No such file or directory
g++.exe: error: unrecognized command line option '-m'
g++.exe: error: unrecognized command line option '--includes EO_functions_bipartite.cpp'
g++.exe: fatal error: no input files
compilation terminated.
Assuming you have python in your path.
The backtick escape thing that embeds the python -m pybind11 --includes command within the g++ doesn't work on cmd.exe in Windows.
Run the python -m pybind11 --includes command on its own line in the cmd shell. Take the output of that command and substitute in into the g++ command. It should be a bunch of -I include params.
So if the output of the python command is this:
-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\Include -IC:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pybind11\include
Expand your g++ command to be this:
g++ -O3 -Wall -shared -std=c++11 -fPIC "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\Include" -IC:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pybind11\include EO_functions_bipartite.cpp -o extremal_bi.so
Notice the quotes I put around the first include directory because it has a space in its path.
The easiest way to start on native Windows if you have a Linux background is to install MSYS2 shell with MinGW-w64. This will provide an actual bash that allows you to run commands almost exactly the same way as on Linux, including support for backticks like in the case of your issue.
Though I would always recommend using $( ... ) instead of backticks, as this allows nesting.
Note that MinGW-w64 also exists on Windows to allow cross-building for Windows from Linux, but that may be a bit more difficult if you have never done any cross-building before.
Also -shared ... -o extremal_bi.so in your command should be replaced with -shared ... -o extremal_bi.dll -Wl,--out-implib,libextremal_bi.dll.a as .so files don't exist on Windows as Windows uses .dll files for shared libraries and the compiler uses .dll.a files as library objects for them.
Finally on Windows you need to tell the compiler or linker which symbols you will be exporting by either writing a libextremal_bi.def starting with the line EXPORTS followed all the symbols you want to be exported and include -def libextremal_bi.def in the link command, or using __declspec(dllexport)/__declspec(dllimport) when defining those symbols, which may be a bit complexer as it requires some conditional defines to determine if the code is being compiled for Windows and if it's during the actual build process of the shared library (__declspec(dllexport)) or code that uses it (__declspec(dllimport)). There is also another method to export all symbols, but that's a dirty method that may more easily cause symbol conflicts.
I'm new to C++, I am trying to compile gtest with Cygwin. I have installed the GNU g++ compiler which works fine. I ran the following command on Cygwin:
g++ -I /cygdrive/c/devel/cpp/gtest/include -I /cygdrive/c/devel/cpp/gtest -pthread -c /cygdrive/c/devel/cpp/gtest/googletest/src/gtest-all.cc
/cygdrive/c/devel/cpp/gtest/googletest/src/gtest-all.cc:39:25: fatal error: gtest/gtest.h: No such file or directory
compilation terminated.
All the files seem to be in place, however the error does not go, any ideas why?
It looks like you have provided space between -I and path.
There should not be any space between -I and corresponding path.
It should be like
g++ -I/cygdrive/c/devel/cpp/gtest/include -I/cygdrive/c/devel/cpp/gtes..
Check it.
two simple questions:
how do i call eclipse cdt generated make file with all the environment variable ? for example, my make file is generated at location PROJECT_FOLDER_ROOT/Debug/makefile , and if i try to call it:
khan#khan-P55A-UD3P:~/git/gcc/libGCC/Debug$ make -k -j5 all
Building file: ../src/utility/Versioning.cpp
Invoking: Cross G++ Compiler
mipsel-openwrt-linux-g++ -I/home/khan/carambola.pristine/staging_dir/target-mipsel_r2_uClibc-0.9.33.2/usr/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/utility/Versioning.d" -MT"src/utility/Versioning.d" -o "src/utility/Versioning.o" "../src/utility/Versioning.cpp"
/bin/sh: 1: mipsel-openwrt-linux-g++: not found
make: * [src/utility/Versioning.o] Error 127
make: Target `all' not remade because of errors.
it is looking for mipsel-openwrt-linux-g++ , which is an environment variable for the eclipse build system . how to include it in the command line usage?
second question:
is there any way to automatically increment build number in CDT ? google search was not helpful in this regard.
right after asking here, it managed to figure out the eclipse makefile issue:
i wrote this script to do it. hope it helps someone:
#!/bin/bash
CURRENT_PATH=$PWD
DEBUG_FOLDER_PATH=$CURRENT_PATH/Debug
TOOLCHAIN_PATH=/home/khan/carambola.pristine/staging_dir/toolchain-mipsel_r2_gcc-4.7-linaro_uClibc-0.9.33.2/bin
cd $DEBUG_FOLDER_PATH
export CWD=$DEBUG_FOLDER_PATH
export PWD=$DEBUG_FOLDER_PATH
export PATH=$TOOLCHAIN_PATH:$PATH
echo $CWD
echo $PWD
echo $PATH
make -k -j5 $1 $2 $3 $4
however, i am still looking for a way to increment build number somehow. any help would be appreciated.
thnkyou