When i run make all in msys2 for SDL 1.2.14, i see this:
/bin/sh ./libtool --mode=compile gcc -g -O2 -I./include -D_GNU_SOURCE=1 -c ./src/video/SDL_RLEaccel.c -o build/SDL_RLEaccel.lo
libtool: compile: gcc -g -O2 -I./include -D_GNU_SOURCE=1 -c ./src/video/SDL_RLEaccel.c -DDLL_EXPORT -DPIC -o build/.libs/SDL_RLEaccel.o
In file included from ./src/video/SDL_RLEaccel.c:90:0:
./src/video/SDL_sysvideo.h:188:0: warning: "WINAPI" redefined
#define WINAPI
^
In file included from /usr/include/w32api/windef.h:8:0,
from /usr/include/w32api/windows.h:69,
from /usr/include/w32api/GL/gl.h:13,
from ./include/SDL_opengl.h:46,
from ./src/video/SDL_sysvideo.h:37,
from ./src/video/SDL_RLEaccel.c:90:
/usr/include/w32api/minwindef.h:98:0: note: this is the location of the previous definition
#define WINAPI __stdcall
^
/tmp/cc6gwyDo.s: Assembler messages:
/tmp/cc6gwyDo.s:3611: Error: operand type mismatch for `movq'
/tmp/cc6gwyDo.s:4101: Error: operand type mismatch for `movq'
/tmp/cc6gwyDo.s:4493: Error: operand type mismatch for `movq'
/tmp/cc6gwyDo.s:4969: Error: operand type mismatch for `movq'
/tmp/cc6gwyDo.s:6895: Error: operand type mismatch for `movq'
/tmp/cc6gwyDo.s:7240: Error: operand type mismatch for `movq'
/tmp/cc6gwyDo.s:7593: Error: operand type mismatch for `movq'
/tmp/cc6gwyDo.s:8125: Error: operand type mismatch for `movq'
make: *** [build-deps:536: build/SDL_RLEaccel.lo] Error 1
./configure finished with no errors (details here) What's wrong? And how can i compile it?
I'm trying to compile my project, it contains many files and it need 3 libraries gsl,libxml,boost
when i give the terminal the g++ command on ubuntu 14.04LTS
g++ -Wall -I/usr/include/libxml2 -I/usr/include/gsl main.cpp YUNucNet.cpp src/*.cpp -lxml2 -lgsl -lm -lgslcblas -lboost_system -lboost_filesystem
it gives me these error
In file included from /usr/include/boost/lexical_cast.hpp:34:0,
/usr/include/c++/4.8/typeinfo:39:37: error: expected ‘}’ before end of line
#pragma GCC visibility push(default)
^
/usr/include/c++/4.8/typeinfo:39:37: error: expected unqualified-id before end of line
/usr/include/c++/4.8/typeinfo:39:37: error: expected declaration before end of line
what would be the problem ???? I can't get it .
thanx
default is a c++11 token.
You need to compile with -std=c++0x or something similar. Make sure your gcc is new enough to support such things.
I compile my code with the flag -std=c++11 given, and I get all kinds of errors depicting that I should use the same flag. Also, auto is not recognised being a type.
Makefile:
GCCPATH = /path/gcc/5.3.0
CC = $(GCCPATH)/bin/g++
DARGS = -ggdb #debug arguments
CARGS = -std=c++11 #C arguments
WARGS = -Wall -Wextra #warning arguments
AARGS = $(DARGS) $(CARGS) $(WARGS) #all arguments
GCCLIBPATH = $(GCCPATH)/lib64
LIBS = -l curl
LIBD = -L $(GCCLIBPATH) -Wl,-rpath=$(GCCLIBPATH)
.PHONY: webspider
webspider: ../title/htmlstreamparser.o filesystem.o
$(CC) $(AARGS) -o $# $#.cpp $+ $(LIBS) $(LIBD)
filesystem:
$(CC) $(AARGS) -c $#.cpp
The warnings and errors I get:
warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
warning: range-based ‘for’ loops only available with -std=c++11 or -std=gnu++11
error: ‘weblink’ does not name a type
for(auto weblink: weblinks)
Now my question is: What should I do to make g++ recognise this clearly given flag?
I also tried to replace it with -std=c++0x, to no avail.
EDIT:
Full output of make:
g++ -c -o filesystem.o filesystem.cpp
In file included from filesystem.cpp:1:0:
filesystem.hpp:23:36: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
std::string dir = getCurrentPath();
^
filesystem.cpp: In member function ‘std::__cxx11::string Filesystem::createMD5(std::__cxx11::string)’:
filesystem.cpp:49:19: warning: range-based ‘for’ loops only available with -std=c++11 or -std=gnu++11
for(long long c: result)
^
filesystem.cpp: In member function ‘void Filesystem::createLinkIndex(std::__cxx11::string, strVec)’:
filesystem.cpp:57:11: error: ‘weblink’ does not name a type
for(auto weblink: weblinks) {
^
filesystem.cpp:61:1: error: expected ‘;’ before ‘}’ token
}
^
filesystem.cpp:61:1: error: expected primary-expression before ‘}’ token
filesystem.cpp:61:1: error: expected ‘;’ before ‘}’ token
filesystem.cpp:61:1: error: expected primary-expression before ‘}’ token
filesystem.cpp:61:1: error: expected ‘)’ before ‘}’ token
filesystem.cpp:61:1: error: expected primary-expression before ‘}’ token
make: *** [filesystem.o] Error 1
The problem is you do not specify all your dependencies, in particular how to build all your intermediate object files.
So what happens is make makes up its own rules and invisibly sneaks them in while you're not looking.
The way to control these implicit rules is through setting the correct predefined variables:
CXX := $(GCCPATH)/bin/g++ # c++ compiler
CPPFLAGS := -I/path/to/headers # preprocessor flags
CXXFLAGS := -std=c++11 # compiler flags
LDFLAGS := -L/path/to/libs # linker flags
LDLIBS := -lcurl # libraries to link
# etc...
By using the correct predefined variables, rather than making up your own, you can save a lot of work when building a Makefile.
In the end, based on the comments, it was fixed by changing
filesystem:
$(CC) $(AARGS) -c $#.cpp
to
filesystem.o: filesystem.cpp
$(CC) $(AARGS) -c $+
as Makefile did not understand that I was trying to make filesystem.o with the rule filesystem: .... When stating this explicitely, it worked as intended.
Advantage of this method over the answer of Galik is the ability to use own variables, albeit in this case not that much of an advantage since it is a small project.
I am trying to run a couple of fixed-formatted Fortran 90 files on a PC. They run flawlessly with gfortran version 4.1.1, but not with gfortran 4.1.2 or later (I tried). Here are all the things I've tried:
I tried using the tag "-std=legacy" in Cygwin with version 4.9.3 so the processor compiles the code as a Fortran 77 file. I had to work out some kinks, but eventually it began to work splendidly. Then the following error popped up:
Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_DIVIDE_BY_ZERO IEEE_OVERFLOW_FLAG IEEE_DENORMAL
I then moved on to plan B: trying to get gfortran 4.1.1 on my PC, on Cygwin.
Building gfortran 4.1.1 from source in Cygwin (since I can't find binary files anywhere online). Cygwin already has a package for gfortran, but only version 4.9.3. I used gcc-fortran-4.1.1.tar.bz2; basically I want to downgrade gfortran in Cygwin. the files in the tarball were lacking so I had to debug some things and add some files with some wget's (like the most current versions of config.guess and config.sub) to get it to configure (I also used autoconf, autoreconf, and automake). Long story short, I tried to run make and I got a long list of errors.
I have access to a Linux machine with gfortran 4.1.1 already on it (on which it works perfectly), and tried to make it there, but it gave a lot of errors as well, completely different from those from Cygwin. At the end are the errors, the first being those from Cygwin and the latter from Linux. I access the Linux computer remotely via SSH; the entire point of this endeavor is to run the codes on PC's (and/or Mac's) so that we don't have to transfer thousands of images and files back and forth.
I tried to download g95 onto Cygwin via the tarball g95-x86-cygwin-41.tgz found online. The INSTALL file said I just need to extract the files in the root directory, create a symbolic link somewhere, and it should work. I did and then I typed it in and nothing happened; no "-bash: ... No such file or directory" error or other errors, but simply nothing. No executable was created-nothing. I even mispelled --version and no error popped up.
J Double B#jdoubleb-PC /wexlerwork/autismcases_CTs/autismcases_23_VOID
$ g95 --versio
J Double B#jdoubleb-PC /wexlerwork/autismcases_CTs/autismcases_23_VOID
$ g95 --version
J Double B#jdoubleb-PC /wexlerwork/autismcases_CTs/autismcases_23_VOID
$ g95 --help
J Double B#jdoubleb-PC /wexlerwork/autismcases_CTs/autismcases_23_VOID
$ man g95
No manual entry for g95
J Double B#jdoubleb-PC /wexlerwork/autismcases_CTs/autismcases_23_VOID
$ g95 ver5.2_v3.5.f -o f05
J Double B#jdoubleb-PC /wexlerwork/autismcases_CTs/autismcases_23_VOID
I even tried the self-extracting files for gcc 4.1 from the following website: http://g95.org/downloads.shtml. I tried the HTTP link and it gave me the tarball I mentioned above. I tried the FTP link and it did nothing useful.
I tried g95 via MinGW and my Windows 7 command shell (from the Start menu). It was an executable, so it was nice to not have to build it. It downloaded and it works. However, there are a lot of errors. It didn't recognize all the comments beginning with 'c', so I changed them all to !'s. Then the compiler mentioned continuations. There are hundreds of continuations in the code, and only a limited amount are allowed per version and format type I think. Essentially the compiler processes Fortran 95 files (naturally-it's in the name), but the file is not a Fortran file. I tried to pass a "-std=legacy" or something similar, but apparently the only options are for Fortran 95, 2003, and 2008. It'd take forever to change a 7000-line and a 3000-line Fortran 77/90 file to Fortran 95 files, so I stopped. Well, I figured I'd give it a try.
I tried changing the extensions of the files to *.f90, but they were interpreted by my computer to be Fortran 95 files and it didn't work.
I'd rather not continue to try and change the codes so they work for some kind of compiler, but rather simply get gfortran 4.1.1 on my computer and have them running just like on the Linux computer. I'd also like to not have to build anything from source-executables for Fortran compilers are welcome. However, I'm not completely closed to the prospect.
Any help from anyone is welcome; thank you in advance for your consideration.
*FROM CYGWIN*
J Double B#jdoubleb-PC /gcc-4.1.1
$ make
cat: libgfortran/../gcc/BASE-VER: No such file or directory
makefile:2442: warning: overriding commands for target `.F90.o'
makefile:1059: warning: ignoring old commands for target `.F90.o'
makefile:2445: warning: overriding commands for target `.F90.obj'
makefile:1062: warning: ignoring old commands for target `.F90.obj'
makefile:2448: warning: overriding commands for target `.F90.lo'
makefile:1065: warning: ignoring old commands for target `.F90.lo'
C:/Users/jdoubleb/Documents/Academia/Cygwin_etal/bin/sh.exe libgfortran/mk-kinds-h.sh ' -I . -Wall -fno-repack-arrays -fno-underscoring ' > kinds.h || rm kinds.h
grep '^#' < kinds.h > kinds.inc
grep '^#' < libgfortran/c99_protos.h > c99_protos.inc
cp libgfortran/config/fpu-glibc.h fpu-target.h
C:/Ch/bin/make all-am
cat: libgfortran/../gcc/BASE-VER: No such file or directory
make[1]: Entering directory `C:/Users/jdoubleb/Documents/Academia/Cygwin_etal/gcc-4.1.1'
makefile:2442: warning: overriding commands for target `.F90.o'
makefile:1059: warning: ignoring old commands for target `.F90.o'
makefile:2445: warning: overriding commands for target `.F90.obj'
makefile:1062: warning: ignoring old commands for target `.F90.obj'
makefile:2448: warning: overriding commands for target `.F90.lo'
makefile:1065: warning: ignoring old commands for target `.F90.lo'
C:/Users/jdoubleb/Documents/Academia/Cygwin_etal/bin/sh.exe ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -std=gnu99 -g -O2 -Wunknown-pragmas -c -o compile_options.lo `test -f 'runtime/compile_options.c' || echo 'libgfortran/'`runtime/compile_options.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -std=gnu99 -g -O2 -Wunknown-pragmas -c libgfortran/runtime/compile_options.c -DDLL_EXPORT -DPIC -o .libs/compile_options.o
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:204:9: error: unknown type name ‘GFC_INTEGER_4’
typedef GFC_INTEGER_4 gfc_charlen_type;
^
libgfortran/libgfortran.h:254:51: error: unknown type name ‘GFC_INTEGER_4’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_4) gfc_array_i4;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:255:51: error: unknown type name ‘GFC_INTEGER_8’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_8) gfc_array_i8;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:259:51: error: unknown type name ‘GFC_REAL_4’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_4) gfc_array_r4;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:260:51: error: unknown type name ‘GFC_REAL_8’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_8) gfc_array_r8;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:267:51: error: unknown type name ‘GFC_COMPLEX_4’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_4) gfc_array_c4;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:268:51: error: unknown type name ‘GFC_COMPLEX_8’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_8) gfc_array_c8;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:275:51: error: unknown type name ‘GFC_LOGICAL_4’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_4) gfc_array_l4;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:276:51: error: unknown type name ‘GFC_LOGICAL_8’
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_8) gfc_array_l8;
^
libgfortran/libgfortran.h:245:3: note: in definition of macro ‘GFC_ARRAY_DESCRIPTOR’
type *data;\
^
libgfortran/libgfortran.h:456:51: error: expected ‘)’ before ‘char’
extern const char *gfc_itoa (GFC_INTEGER_LARGEST, char *, size_t);
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:457:16: error: ‘gfc_itoa’ undeclared here (not in a function)
internal_proto(gfc_itoa);
^
libgfortran/libgfortran.h:79:52: note: in definition of macro ‘sym_rename2’
#define sym_rename2(old, ulp, new) extern __typeof(old) old __asm__(#ulp #new)
^
libgfortran/libgfortran.h:77:30: note: in expansion of macro ‘sym_rename1’
#define sym_rename(old, new) sym_rename1(old, __USER_LABEL_PREFIX__, new)
^
libgfortran/libgfortran.h:120:28: note: in expansion of macro ‘sym_rename’
# define internal_proto(x) sym_rename(x, IPREFIX(x))
^
libgfortran/libgfortran.h:457:1: note: in expansion of macro ‘internal_proto’
internal_proto(gfc_itoa);
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:459:48: error: expected ‘)’ before ‘char’
extern const char *xtoa (GFC_UINTEGER_LARGEST, char *, size_t);
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:460:16: error: ‘xtoa’ undeclared here (not in a function)
internal_proto(xtoa);
^
libgfortran/libgfortran.h:79:52: note: in definition of macro ‘sym_rename2’
#define sym_rename2(old, ulp, new) extern __typeof(old) old __asm__(#ulp #new)
^
libgfortran/libgfortran.h:77:30: note: in expansion of macro ‘sym_rename1’
#define sym_rename(old, new) sym_rename1(old, __USER_LABEL_PREFIX__, new)
^
libgfortran/libgfortran.h:120:28: note: in expansion of macro ‘sym_rename’
# define internal_proto(x) sym_rename(x, IPREFIX(x))
^
libgfortran/libgfortran.h:460:1: note: in expansion of macro ‘internal_proto’
internal_proto(xtoa);
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:550:1: warning: parameter names (without types) in function declaration
extern void stop_numeric (GFC_INTEGER_4);
^
libgfortran/libgfortran.h:563:1: error: unknown type name ‘GFC_INTEGER_4’
GFC_INTEGER_4 *internal_pack_4 (gfc_array_i4 *);
^
libgfortran/libgfortran.h:566:1: error: unknown type name ‘GFC_INTEGER_8’
GFC_INTEGER_8 *internal_pack_8 (gfc_array_i8 *);
^
libgfortran/libgfortran.h:574:1: error: unknown type name ‘GFC_COMPLEX_4’
GFC_COMPLEX_4 *internal_pack_c4 (gfc_array_c4 *);
^
libgfortran/libgfortran.h:577:1: error: unknown type name ‘GFC_COMPLEX_8’
GFC_COMPLEX_8 *internal_pack_c8 (gfc_array_c8 *);
^
libgfortran/libgfortran.h:585:54: error: unknown type name ‘GFC_INTEGER_4’
extern void internal_unpack_4 (gfc_array_i4 *, const GFC_INTEGER_4 *);
^
libgfortran/libgfortran.h:588:54: error: unknown type name ‘GFC_INTEGER_8’
extern void internal_unpack_8 (gfc_array_i8 *, const GFC_INTEGER_8 *);
^
libgfortran/libgfortran.h:596:55: error: unknown type name ‘GFC_COMPLEX_4’
extern void internal_unpack_c4 (gfc_array_c4 *, const GFC_COMPLEX_4 *);
^
libgfortran/libgfortran.h:599:55: error: unknown type name ‘GFC_COMPLEX_8’
extern void internal_unpack_c8 (gfc_array_c8 *, const GFC_COMPLEX_8 *);
^
libgfortran/libgfortran.h:609:8: error: unknown type name ‘GFC_INTEGER_4’
extern GFC_INTEGER_4 compare_string (GFC_INTEGER_4, const char *,
^
libgfortran/libgfortran.h:609:53: error: expected ‘)’ before ‘const’
extern GFC_INTEGER_4 compare_string (GFC_INTEGER_4, const char *,
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:611:15: error: ‘compare_string’ undeclared here (not in a function)
iexport_proto(compare_string);
^
libgfortran/libgfortran.h:79:52: note: in definition of macro ‘sym_rename2’
#define sym_rename2(old, ulp, new) extern __typeof(old) old __asm__(#ulp #new)
^
libgfortran/libgfortran.h:77:30: note: in expansion of macro ‘sym_rename1’
#define sym_rename(old, new) sym_rename1(old, __USER_LABEL_PREFIX__, new)
^
libgfortran/libgfortran.h:139:26: note: in expansion of macro ‘sym_rename’
# define export_proto(x) sym_rename(x, PREFIX(x))
^
libgfortran/libgfortran.h:141:27: note: in expansion of macro ‘export_proto’
# define iexport_proto(x) export_proto(x)
^
libgfortran/libgfortran.h:611:1: note: in expansion of macro ‘iexport_proto’
iexport_proto(compare_string);
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:615:26: error: unknown type name ‘GFC_INTEGER_4’
extern void random_seed (GFC_INTEGER_4 * size, gfc_array_i4 * put,
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:617:15: error: ‘random_seed’ undeclared here (not in a function)
iexport_proto(random_seed);
^
libgfortran/libgfortran.h:79:52: note: in definition of macro ‘sym_rename2’
#define sym_rename2(old, ulp, new) extern __typeof(old) old __asm__(#ulp #new)
^
libgfortran/libgfortran.h:77:30: note: in expansion of macro ‘sym_rename1’
#define sym_rename(old, new) sym_rename1(old, __USER_LABEL_PREFIX__, new)
^
libgfortran/libgfortran.h:139:26: note: in expansion of macro ‘sym_rename’
# define export_proto(x) sym_rename(x, PREFIX(x))
^
libgfortran/libgfortran.h:141:27: note: in expansion of macro ‘export_proto’
# define iexport_proto(x) export_proto(x)
^
libgfortran/libgfortran.h:617:1: note: in expansion of macro ‘iexport_proto’
iexport_proto(random_seed);
^
In file included from libgfortran/runtime/compile_options.c:32:0:
libgfortran/libgfortran.h:621:8: error: unknown type name ‘GFC_REAL_4’
extern GFC_REAL_4 normalize_r4_i4 (GFC_UINTEGER_4, GFC_UINTEGER_4);
^
libgfortran/libgfortran.h:621:1: warning: parameter names (without types) in function declaration
extern GFC_REAL_4 normalize_r4_i4 (GFC_UINTEGER_4, GFC_UINTEGER_4);
^
libgfortran/libgfortran.h:624:8: error: unknown type name ‘GFC_REAL_8’
extern GFC_REAL_8 normalize_r8_i8 (GFC_UINTEGER_8, GFC_UINTEGER_8);
^
libgfortran/libgfortran.h:624:1: warning: parameter names (without types) in function declaration
extern GFC_REAL_8 normalize_r8_i8 (GFC_UINTEGER_8, GFC_UINTEGER_8);
^
libgfortran/runtime/compile_options.c:40:1: warning: parameter names (without types) in function declaration
extern void set_std (GFC_INTEGER_4, GFC_INTEGER_4, GFC_INTEGER_4);
^
libgfortran/runtime/compile_options.c:45:10: error: unknown type name ‘GFC_INTEGER_4’
set_std (GFC_INTEGER_4 warn_std, GFC_INTEGER_4 allow_std,
^
libgfortran/runtime/compile_options.c:45:34: error: unknown type name ‘GFC_INTEGER_4’
set_std (GFC_INTEGER_4 warn_std, GFC_INTEGER_4 allow_std,
^
libgfortran/runtime/compile_options.c:46:3: error: unknown type name ‘GFC_INTEGER_4’
GFC_INTEGER_4 pedantic)
^
libgfortran/runtime/compile_options.c: In function ‘set_record_marker’:
libgfortran/runtime/compile_options.c:89:19: error: ‘GFC_INTEGER_4’ undeclared (first use in this function)
if (sizeof (GFC_INTEGER_4) != sizeof (gfc_offset))
^
libgfortran/runtime/compile_options.c:89:19: note: each undeclared identifier is reported only once for each function it appears in
libgfortran/runtime/compile_options.c:94:19: error: ‘GFC_INTEGER_8’ undeclared (first use in this function)
if (sizeof (GFC_INTEGER_8) != sizeof (gfc_offset))
^
make[1]: *** [compile_options.lo] Error 1
make[1]: Leaving directory `C:/Users/jdoubleb/Documents/Academia/Cygwin_etal/gcc-4.1.1'
make: *** [all] Error 2
J Double B#jdoubleb-PC /gcc-4.1.1
*FROM LINUX*
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1 ]$ make
cat: libgfortran/../gcc/BASE-VER: No such file or directory
/bin/sh libgfortran/mk-sik-inc.sh 'gfortran -I . -Wall -fno-repack-arrays -fno-underscoring -g -O2' > selected_int_kind.inc || rm selected_int_kind.inc
/bin/sh libgfortran/mk-srk-inc.sh 'gfortran -I . -Wall -fno-repack-arrays -fno-underscoring -g -O2' > selected_real_kind.inc || rm selected_real_kind.inc
/bin/sh libgfortran/mk-kinds-h.sh 'gfortran -I . -Wall -fno-repack-arrays -fno-underscoring -g -O2' > kinds.h || rm kinds.h
grep '^#' < kinds.h > kinds.inc
grep '^#' < libgfortran/c99_protos.h > c99_protos.inc
cp libgfortran/config/fpu-glibc.h fpu-target.h
make all-am
cat: libgfortran/../gcc/BASE-VER: No such file or directory
make[1]: Entering directory `/home/wexlerlab/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1'
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -c -o compile_options.lo `test -f 'runtime/compile_options.c' || echo 'libgfortran/'`runtime/compile_options.c
mkdir .libs
gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -c libgfortran/runtime/compile_options.c -fPIC -DPIC -o .libs/compile_options.o
gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -c libgfortran/runtime/compile_options.c -o compile_options.o >/dev/null 2>&1
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -c -o environ.lo `test -f 'runtime/environ.c' || echo 'libgfortran/'`runtime/environ.c
gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -c libgfortran/runtime/environ.c -fPIC -DPIC -o .libs/environ.o
In file included from libgfortran/runtime/environ.c:37:
libgfortran/runtime/../io/io.h:36:18: error: gthr.h: No such file or directory
In file included from libgfortran/runtime/environ.c:37:
libgfortran/runtime/../io/io.h:504: error: expected specifier-qualifier-list before '__gthread_mutex_t'
libgfortran/runtime/../io/io.h:699: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'unit_lock'
libgfortran/runtime/../io/io.h:700: error: 'unit_lock' undeclared here (not in a function)
libgfortran/runtime/../io/io.h:700: warning: type defaults to 'int' in declaration of 'unit_lock'
libgfortran/runtime/../io/io.h: In function 'inc_waiting_locked':
libgfortran/runtime/../io/io.h:890: error: 'gfc_unit' has no member named 'waiting'
libgfortran/runtime/../io/io.h:890: error: incompatible type for argument 1 of '__sync_fetch_and_add'
libgfortran/runtime/../io/io.h: In function 'predec_waiting_locked':
libgfortran/runtime/../io/io.h:900: error: 'gfc_unit' has no member named 'waiting'
libgfortran/runtime/../io/io.h:900: error: incompatible type for argument 1 of '__sync_add_and_fetch'
libgfortran/runtime/../io/io.h:904: warning: control reaches end of non-void function
libgfortran/runtime/../io/io.h: In function 'dec_waiting_unlocked':
libgfortran/runtime/../io/io.h:910: error: 'gfc_unit' has no member named 'waiting'
libgfortran/runtime/../io/io.h:910: error: incompatible type for argument 1 of '__sync_fetch_and_add'
make[1]: *** [environ.lo] Error 1
make[1]: Leaving directory `/home/wexlerlab/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1'
make: *** [all] Error 2
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1 ]$ cd libgfortran/
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1/libgfortran ]$ automake
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1/libgfortran ]$ cd..
-bash: cd..: command not found
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1/libgfortran ]$ make
make: *** No targets specified and no makefile found. Stop.
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1/libgfortran ]$ cd ..
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1 ]$ make
cat: libgfortran/../gcc/BASE-VER: No such file or directory
cd . && /bin/sh ./config.status Makefile
config.status: creating Makefile
cat: libgfortran/../gcc/BASE-VER: No such file or directory
make all-am
cat: libgfortran/../gcc/BASE-VER: No such file or directory
make[1]: Entering directory `/home/wexlerlab/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1'
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -c -o environ.lo `test -f 'runtime/environ.c' || echo 'libgfortran/'`runtime/environ.c
gcc -DHAVE_CONFIG_H -I. -Ilibgfortran -I. -iquotelibgfortran/io -Ilibgfortran/../gcc -Ilibgfortran/../gcc/config -I../.././gcc -D_GNU_SOURCE -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -c libgfortran/runtime/environ.c -fPIC -DPIC -o .libs/environ.o
In file included from libgfortran/runtime/environ.c:37:
libgfortran/runtime/../io/io.h:36:18: error: gthr.h: No such file or directory
In file included from libgfortran/runtime/environ.c:37:
libgfortran/runtime/../io/io.h:504: error: expected specifier-qualifier-list before '__gthread_mutex_t'
libgfortran/runtime/../io/io.h:699: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'unit_lock'
libgfortran/runtime/../io/io.h:700: error: 'unit_lock' undeclared here (not in a function)
libgfortran/runtime/../io/io.h:700: warning: type defaults to 'int' in declaration of 'unit_lock'
libgfortran/runtime/../io/io.h: In function 'inc_waiting_locked':
libgfortran/runtime/../io/io.h:890: error: 'gfc_unit' has no member named 'waiting'
libgfortran/runtime/../io/io.h:890: error: incompatible type for argument 1 of '__sync_fetch_and_add'
libgfortran/runtime/../io/io.h: In function 'predec_waiting_locked':
libgfortran/runtime/../io/io.h:900: error: 'gfc_unit' has no member named 'waiting'
libgfortran/runtime/../io/io.h:900: error: incompatible type for argument 1 of '__sync_add_and_fetch'
libgfortran/runtime/../io/io.h:904: warning: control reaches end of non-void function
libgfortran/runtime/../io/io.h: In function 'dec_waiting_unlocked':
libgfortran/runtime/../io/io.h:910: error: 'gfc_unit' has no member named 'waiting'
libgfortran/runtime/../io/io.h:910: error: incompatible type for argument 1 of '__sync_fetch_and_add'
make[1]: *** [environ.lo] Error 1
make[1]: Leaving directory `/home/wexlerlab/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1'
make: *** [all] Error 2
[wexlerlab#AirWay~/Jeremiah/gcc-fortran-4.1.1/gcc-4.1.1 ]$
I am trying to compile my code using libboost library, by putting #include <boost/python.hpp> in my C++ code. Could somebody please help me the right command to run this, especially to include and link the library. I'm pretty basic in this.
The command used(but not working):
g++ try.cpp -L /usr/lib/libboost_python.so -o try
EDIT:
The tested code:
#include <boost/python.hpp>
#include <iostream>
int main()
{
std::cout << "Yes, it works :-)" << std::endl;
return 0;
}
Error messages:
from try.cpp:1:
/usr/include/boost/python/enum.hpp:31: error: expected ‘;’ before ‘*’ token
/usr/include/boost/python/enum.hpp:32: error: expected ‘;’ before ‘(’ token
/usr/include/boost/python/enum.hpp:33: error: ‘PyObject’ has not been declared
/usr/include/boost/python/enum.hpp:52: error: expected constructor, destructor, or type conversion before ‘*’ token
/usr/include/boost/python/enum.hpp:67: error: ‘void* boost::python::enum_<T>::convertible_from_python’ is not a static member of ‘struct boost::python::enum_<T>’
/usr/include/boost/python/enum.hpp:67: error: template definition of non-template ‘ void* boost::python::enum_<T>::convertible_from_python’
/usr/include/boost/python/enum.hpp:67: error: ‘PyObject’ was not declared in this scope
/usr/include/boost/python/enum.hpp:67: error: ‘obj’ was not declared in this scope
/usr/include/boost/python/enum.hpp:80: error: variable or field ‘construct’ declared void
/usr/include/boost/python/enum.hpp:80: error: ‘PyObject’ was not declared in this scope
/usr/include/boost/python/enum.hpp:80: error: ‘obj’ was not declared in this scope
/usr/include/boost/python/enum.hpp:80: error: expected primary-expression before ‘*’ token
/usr/include/boost/python/enum.hpp:80: error: ‘data’ was not declared in this scope
Another thing is that when I compile g++ -Wall thread_one.cpp -o thread_one -lboost_thread, that works in order to use boost_thread library.
Try this:
g++ try.cpp -o try -lboost_python
It'd be good style to also add -W -Wall -Wextra -pedantic to your compiler invocation (so that your next SO question can be more specific :-)). Also, -O2 or -O3 for optimization is probably a very good idea, especially with Boost. Finally, splitting the building up into separate stages makes recompiling faster when you have multiple files:
g++ -c -o try.o try.cpp -W -Wall -Wextra -pedantic -O2
g++ -o try try.o -s -lboost_python
Finally, it is working. The command used is as below:
g++ -I/usr/include/python2.6 try.cpp -o try -lboost_python -lpython2.6