Barrier file not found (C++ Makefile) - c++

I am trying to compile a project however the make command returns with the error
fatal error: 'barrier' file not found
and after changing clang versions and changing my platform, nothing seems to help. Therefore I would like to ask for assistance regarding this issue.
Here is my makefile:
CC = clang
CXX = clang++
CFLAGS := $(CFLAGS) -g -O3 -Wall -Wextra -pedantic -Werror -std=c18 -pthread
CXXFLAGS := $(CXXFLAGS) -stdlib=libc++ -g -O3 -Wall -Wextra -pedantic -Werror -std=c++20 -pthread
all: project
SRCS = main.cpp input.cpp output.cpp project.cpp
project: $(SRCS:%=%.o)
$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $#
.PHONY: clean
clean:
rm -f *.o project
DEPDIR := .deps
DEPFLAGS = -MT $# -MMD -MP -MF $(DEPDIR)/$<.d
COMPILE.c = $(CC) $(DEPFLAGS) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
COMPILE.cpp = $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
%.c.o: %.c
%.c.o: %.c $(DEPDIR)/%.c.d | $(DEPDIR)
$(COMPILE.c) $(OUTPUT_OPTION) $<
%.cpp.o: %.cpp
%.cpp.o: %.cpp $(DEPDIR)/%.cpp.d | $(DEPDIR)
$(COMPILE.cpp) $(OUTPUT_OPTION) $<
$(DEPDIR): ; #mkdir -p $#
DEPFILES := $(SRCS:%=$(DEPDIR)/%.d) $(DEPDIR)/client.c.d
$(DEPFILES):
include $(wildcard $(DEPFILES))
EDIT
The platform details:
clang --version output:
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
OS details:
NAME="Ubuntu"
VERSION="18.04.6 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.6 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
Full error:
clang++ -MT project.cpp.o -MMD -MP -MF .deps/project.cpp.d -stdlib=libc++ -g -O3 -Wall -Wextra -pedantic -Werror -std=c++1z -pthread -c -o project.cpp.o project.cpp
In file included from project.cpp:1:
./project.hpp:9:10: fatal error: 'barrier' file not found
#include <barrier>
^~~~~~~~~
1 error generated.
Makefile:33: recipe for target 'project.cpp.o' failed
make: *** [project.cpp.o] Error 1
EDIT-2
flag c++20 gives off error: invalid value 'c++20' in '-std=c++20'

Related

linux C++ gmake "No rule to make target"

It's been a couple decades since I've had to manage makefiles. I've checked existing answers here, as well as googling elsewhere. When I use the target: $(BIN)/$(EXECUTABLE): $(OBJECTS)
I'm stumped as to why my makefile is failing with:
$ make
make: *** No rule to make target 'src/SRecord.o', needed by 'bin/main'. Stop.
Here's the Makefile:
# execute `make D='-g'` to make with debug symbols
DEFS := $(D)
CC := gcc $(DEFS)
CFLAGS := -std=c99 -Wall -Wextra
CXX := g++ $(DEFS)
CXXFLAGS := -std=c++17 -Wall -Wextra
BIN := bin
SRC := src
INCLUDE := include
LIB := lib
#LIBSOURCES := $(wildcard $(LIB)/*.cpp)
#LIBOBJECTS := $(LIBSOURCES:%.cpp=%.o)
#OBJECTS := $(subst $(LIB)/,,$(LIBOBJECTS))
SOURCES := $(wildcard $(SRC)/*.cpp)
OBJECTS := $(SOURCES:%.cpp=%.o)
# SOURCES := \
# $(SRC)/main.cpp \
# $(SRC)/SerialPort.cpp \
# $(SRC)/ShadowUpdate.cpp \
# $(SRC)/SRecord.cpp
# OBJECTS := \
# $(SRC)/SerialPort.o \
# $(SRC)/ShadowUpdate.o \
# $(SRC)/SRecord.o
EXECUTABLE := main
#
# Targets
#
.PHONY: clean all
all: $(BIN)/$(EXECUTABLE)
clean:
$(RM) $(BIN)/$(EXECUTABLE)
$(RM) $(OBJECTS)
run: all
./$(BIN)/$(EXECUTABLE)
# $(BIN)/$(EXECUTABLE): $(SRC)/*
$(BIN)/$(EXECUTABLE): $(OBJECTS)
$(CXX) $(CXXFLAGS) -I$(INCLUDE) -L$(LIB) $^ -o $#
#
# Dependencies - must be at end of makefile
#
DEPDIR := .d
$(shell mkdir -p $(DEPDIR) >/dev/null)
DEPFLAGS = -MT $# -MMD -MP -MF $(DEPDIR)/$*.Td
POSTCOMPILE = #mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d && touch $#
%.o: %.c
%.o: %.c $(DEPDIR)/%.d
$(CC) -c -o $*.o $(DEPFLAGS) $(CFLAGS) $<
$(POSTCOMPILE)
%.o: %.cpp
%.o: %.cpp $(DEPDIR)/%.d
$(CXX) -c -o $*.o $(DEPFLAGS) $(CXXFLAGS) $<
$(POSTCOMPILE)
$(DEPDIR)/%.d: ;
.PRECIOUS: $(DEPDIR)/%.d
include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(SOURCES))))
It works with the commented out target: # $(BIN)/$(EXECUTABLE): $(SRC)/*
But, I want to be able to have a more complex project than simply listing all the source files as dependencies to the executable.
Here's my file tree:
src/
src/SerialPort.cpp
src/SRecord.cpp
src/ShadowUpdate.cpp
src/main.cpp
include
include/ShadowUpdate.h
include/SerialPort.h
include/SRecord.h
include/the_exo.h
bin/
bin/main
Makefile
lib/
.d/
The automatic dependency generation isn't working either, even though it is straight from GNU's website.
Think about what the % expands to in
%.o: %.cpp $(DEPDIR)/%.d
plugging in src/SRecord.o:
src/SRecord.o: src/SRecord.cpp .d/src/SRecord.d
Can you see the issue? Try the following instead
$(SRC)/%.o: $(SRC)/%.cpp $(SRC)/$(DEPDIR)/%.d
You won't need the lines that override the built-in recipes (%.o: %.cpp), get rid of them.
For clarity to anyone looking for the answer in the future, I'm posting my revised Makefile:
BIN := bin
SRC := src
INCLUDE := include
LIB := lib
# execute `make D='-g'` to make with debug symbols
DEFS := $(D)
CC := gcc $(DEFS)
CFLAGS := -I$(INCLUDE) -std=c99 -Wall -Wextra
CXX := g++ $(DEFS)
CXXFLAGS := -I$(INCLUDE) -std=c++17 -Wall -Wextra
#LIBSOURCES := $(wildcard $(LIB)/*.cpp)
#LIBOBJECTS := $(LIBSOURCES:%.cpp=%.o)
#OBJECTS := $(subst $(LIB)/,,$(LIBOBJECTS))
SOURCES := $(wildcard $(SRC)/*.cpp)
OBJECTS := $(SOURCES:%.cpp=%.o)
EXECUTABLE := main
#
# Targets
#
.PHONY: clean all
all: $(BIN)/$(EXECUTABLE)
clean:
$(RM) $(BIN)/$(EXECUTABLE)
$(RM) $(OBJECTS)
run: all
./$(BIN)/$(EXECUTABLE)
$(BIN)/$(EXECUTABLE): $(OBJECTS)
$(CXX) $(CXXFLAGS) -L$(LIB) $^ -o $#
#
# Dependencies - must be at end of makefile
#
DEPDIR := $(SRC)/.d
$(shell mkdir -p $(DEPDIR) >/dev/null)
DEPFLAGS = -MT $# -MMD -MP -MF $(DEPDIR)/$*.Td
POSTCOMPILE = #mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d && touch $#
%.o: %.c
%.o: %.c $(DEPDIR)/%.d
$(CC) -c -o $# $(DEPFLAGS) $(CFLAGS) $<
$(POSTCOMPILE)
%.o: %.cpp
$(SRC)/%.o: $(SRC)/%.cpp $(DEPDIR)/%.d
$(CXX) -c -o $# $(DEPFLAGS) $(CXXFLAGS) $<
$(POSTCOMPILE)
$(DEPDIR)/%.d: ;
.PRECIOUS: $(DEPDIR)/%.d
include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(SOURCES))))
To clarify my comment to the above answer, if I comment out the "override" target (%.o: %.cpp), here's the output:
$ make clean; make
rm -f bin/main
rm -f src/SRecord.o src/SerialPort.o src/ShadowUpdate.o src/main.o
g++ -Iinclude -std=c++17 -Wall -Wextra -c -o src/SRecord.o src/SRecord.cpp
g++ -Iinclude -std=c++17 -Wall -Wextra -c -o src/SerialPort.o src/SerialPort.cpp
g++ -Iinclude -std=c++17 -Wall -Wextra -c -o src/ShadowUpdate.o src/ShadowUpdate.cpp
g++ -Iinclude -std=c++17 -Wall -Wextra -c -o src/main.o src/main.cpp
g++ -Iinclude -std=c++17 -Wall -Wextra -Llib src/SRecord.o src/SerialPort.o src/ShadowUpdate.o src/main.o -o bin/main
Clearly, the dependencies are not being made. My rule was not executed.
But, with the empty %.o: %.cpp target in place, the make performs as expected:
$ make clean; make
rm -f bin/main
rm -f src/SRecord.o src/SerialPort.o src/ShadowUpdate.o src/main.o
g++ -c -o src/SRecord.o -MT src/SRecord.o -MMD -MP -MF src/.d/SRecord.Td -Iinclude -std=c++17 -Wall -Wextra src/SRecord.cpp
g++ -c -o src/SerialPort.o -MT src/SerialPort.o -MMD -MP -MF src/.d/SerialPort.Td -Iinclude -std=c++17 -Wall -Wextra src/SerialPort.cpp
g++ -c -o src/ShadowUpdate.o -MT src/ShadowUpdate.o -MMD -MP -MF src/.d/ShadowUpdate.Td -Iinclude -std=c++17 -Wall -Wextra src/ShadowUpdate.cpp
g++ -c -o src/main.o -MT src/main.o -MMD -MP -MF src/.d/main.Td -Iinclude -std=c++17 -Wall -Wextra src/main.cpp
g++ -Iinclude -std=c++17 -Wall -Wextra -Llib src/SRecord.o src/SerialPort.o src/ShadowUpdate.o src/main.o -o bin/main

c++ undefined reference to `main' while compiling

After try to use this attached makefile the error that appears is :
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [Ass1F] Error 1
the makefile is :
all: Ass1F
Ass1F: bin/main.o bin/x.o bin/y.o bin/z.o bin/w.o
g++ -o bin/main.o bin/x.o bin/y.o bin/z.o bin/w.o
#echo 'Finished building target: Ass1F'
#echo ' '
bin/x.o: src/x.cpp
g++ -g -Wall -Weffc++ -c -Linclude -o bin/x.o src/x.cpp
bin/y.o: src/y.cpp
g++ -g -Wall -Weffc++ -c -Linclude -o bin/y.o src/y.cpp
bin/z.o: src/z.cpp
g++ -g -Wall -Weffc++ -c -Linclude -o bin/z.o src/z.cpp
bin/w.o: src/w.cpp
g++ -g -Wall -Weffc++ -c -Linclude -o bin/w.o src/w.cpp
bin/main.o: src/main.cpp
g++ -g -Wall -Weffc++ -c -Linclude -o bin/main.o src/main.cpp
clean:
rm -f bin/*
what should I do with this problem?
the reason is the makefile or something in the code?
just to let you know we used eclipse to write the code and everything work perfectly- no any bugs.
thanks
Line g++ -o bin/main.o bin/x.o bin/y.o bin/z.o bin/w.o tries to create executable named bin/main.o, overwriting its previous contents.
It should be e.g. g++ -o Ass1F bin/main.o bin/x.o bin/y.o bin/z.o bin/w.o
Your makefile recipe for Ass1F is incorrect, it doesn't specify the output file, os make uses bin/main.o as the output file instead of one of the input files.
You can simplify the makefile by using pattern rules (i.e. with wildcards) and using pre-defined variables such as $# (the name of the target) and $^ (the list of prerequisites) and CXX (the C++ compiler):
CXXFLAGS = -g -Wall -Weffc++
CPPFLAGS =
LDFLAGS =
LDLIBS =
all: Ass1F
Ass1F: bin/main.o bin/x.o bin/y.o bin/z.o bin/w.o
$(CXX) $(LDFLAGS) -o $# $^ $(LDLIBS)
#echo 'Finished building target: Ass1F'
#echo ' '
bin/%.o: src/%.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $# $^
clean:
rm -f bin/*

Error while compiling with a makefile and c++11

I currently have a problem with a C++ project I have. I need some tools provided with C++11 but when I want to compile with a Makefile, I have the error :
error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
Here is my Makefile :
.PHONY: clean, mrproper
# var
CXX = g++
EXEC = tablut
LDFLAGS =
CXXFLAGS = -std=c++11 -Wall -Wextra
SRC= partie.cpp pawn.cpp playground.cpp
OBJ= $(SRC:.c=.o)
# commands
all: $(EXEC)
tablut: $(OBJ)
$(CXX) -o tablut $(OBJ) $(LDFLAGS)
%.o: %.cpp
$(CXX) -o $# -c $< $(CXXFLAGS)
clean:
rm -rf *.o
mrproper: clean
rm -rf tablut
The funny thing is that my code compile if I enter the command g++ -c std=c++11 ...
What did I do wrong ?
NB : I tried with the flags -std=c++11, -std=c++0x and -std=gnu++11
You have the rule:
OBJ= $(SRC:.c=.o)
Which means that $(OBJ) ends up being:
OBJ= partie.cpp pawn.cpp playground.cpp
Because none of them match .c. You probably mean to write:
OBJ= $(SRC:.cpp=.o)
With that fix, running make produces:
$ make
g++ -o partie.o -c partie.cpp -std=c++11 -Wall -Wextra
g++ -o pawn.o -c pawn.cpp -std=c++11 -Wall -Wextra
g++ -o playground.o -c playground.cpp -std=c++11 -Wall -Wextra
g++ -o tablut partie.o pawn.o playground.o
Which is probably what you wanted.

How to compile arduino core library with makefile?

I want to create library files (.a) of the arduino core library, eventually also the other libraries (SPI, ...), with a makefile, but I can't get it to work!
This is my makefile:
CC=avr-gcc
CPP=avr-g++
MCU=-mmcu=atmega328p
CPU_SPEED=-DF_CPU=16000000UL
CFLAGS=$(MCU) $(CPU_SPEED) -g2 -gstabs -Os -Wall \
-ffunction-sections -fdata-sections -fno-exceptions
INCLUDE=-I./arduinoCORE
CFILES=$(wildcard ./arduinoCORE/*.c)
CPPFILES=$(wildcard ./arduinoCORE/*.cpp)
OBJ=$(CFILES:.c=.o) $(CPPFILES:.cpp=.o)
default: $(OBJ)
avr-ar -r libarduinoUNO.a $^
%.o : %.c
$(CC) $< $(CFLAGS) -c -o $#
%.o : %.cpp
$(CPP) $< $(CFLAGS) -c -o $#
(all header and source files are in arduinoCORE; even pins_arduino.h)
After $ make in directory above arduinoCORE I get this error message:
avr-g++ arduinoCORE/CDC.cpp -mmcu=atmega328p -DF_CPU=16000000UL -g2 -gstabs -Os -Wall -ffunction-sections -fdata-sections -fno-exceptions -c -o arduinoCORE/CDC.o
In file included from arduinoCORE/Print.h:27:0,
from arduinoCORE/Stream.h:26,
from arduinoCORE/HardwareSerial.h:28,
from arduinoCORE/Arduino.h:193,
from arduinoCORE/Platform.h:15,
from arduinoCORE/CDC.cpp:19:
arduinoCORE/Printable.h:23:17: fatal error: new.h: No such file or directory
#include <new.h>
^
compilation terminated.
make: *** [arduinoCORE/CDC.o] Error 1
The problem is, that new.h is actually in arduinoCORE!
Does anyone know how to manage this?
I had a different error with your code. It displayed Arduino.h as not being present. I fixed it after actually adding the INCLUDE variable to CFLAGS and CPPFLAGS (yours was defined but not added).
I also used CFLAGS and CPPFLAGS as per the Arduino Specification. The code is:
CC=avr-gcc
CPP=avr-g++
MCU=-mmcu=atmega328p
CPU_SPEED=-DF_CPU=16000000UL
INCLUDE=-I./
CFLAGS = -c -g -Os -w -ffunction-sections -fdata-sections -MMD $(MCU) $(CPU_SPEED) $(INCLUDE)
CPPFLAGS = -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD $(MCU) $(CPU_SPEED) $(INCLUDE)
CFILES=$(wildcard ./*.c)
CPPFILES=$(wildcard ./*.cpp)
OBJ=$(CFILES:.c=.o) $(CPPFILES:.cpp=.o)
default: $(OBJ)
avr-ar rcs core.a $^
%.o : %.c
$(CC) $< $(CFLAGS) -c -o $#
%.o : %.cpp
$(CPP) $< $(CPPFLAGS) -c -o $#
Which creates the archive successfully (not tested, just created).

howto compile cryptopp 5.6.2 with mingw

I am trying to build cryptopp 5.6.1 with mingw 4.8.1 (sjlj). I've changed GNUMakefile from Crypto++ & MinGW
But there are several issue:
I've compile error if I try to build it as shared library;
On my machine it works (intel i5 (2nd generation) with Windows 7 ) but on Windows Xp on an Intel atom D2500 an error occured (no entry point for memmove_s in msvcrt.dll )
When I try to build as shared library I've the following error:
make dll
make: *** No rule to make target 'cryptopp.dll', needed by 'cryptest.import.exe'. Stop.
make libcryptopp.dll
// ...
g++ -std=c++11 -DNDEBUG -O3 -m32 -msse2 -msse3 -mssse3 -DCRYPTOPP_EXPORTS -c hex.cpp -o hex.export.o
g++ -std=c++11 -DNDEBUG -O3 -m32 -msse2 -msse3 -mssse3 -DCRYPTOPP_EXPORTS -c hmac.cpp -o hmac.export.o
g++ -std=c++11 -DNDEBUG -O3 -m32 -msse2 -msse3 -mssse3 -DCRYPTOPP_EXPORTS -c integer.cpp -o integer.export.o
g++ -std=c++11 -DNDEBUG -O3 -m32 -msse2 -msse3 -mssse3 -DCRYPTOPP_EXPORTS -c iterhash.cpp -o iterhash.export.o
g++ -std=c++11 -DNDEBUG -O3 -m32 -msse2 -msse3 -mssse3 -DCRYPTOPP_EXPORTS -c misc.cpp -o misc.export.o
g++ -std=c++11 -DNDEBUG -O3 -m32 -msse2 -msse3 -mssse3 -DCRYPTOPP_EXPORTS -c modes.cpp -o modes.export.o
make: *** No rule to make target 'modexppc.export.o', needed by 'libcryptopp.dll'. Stop.
Does someone has compiled succeful crypto++ with mingw 4.8.1? This is the snippet of my makefile:
CXXFLAGS = -std=c++11 -DNDEBUG -O3 -m32 -msse2 -msse3 -mssse3
ARFLAGS = rc
LDLIBS += -lws2_32
LDFLAGS =
MKDIR = mkdir
CP = copy
SRCS = $(wildcard *.cpp)
OBJS = $(SRCS:.cpp=.o)
# test.o needs to be after bench.o for cygwin 1.1.4 (possible ld bug?)
TESTOBJS = bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o
LIBOBJS = $(filter-out $(TESTOBJS),$(OBJS))
DLLSRCS = algebra.cpp algparam.cpp asn.cpp basecode.cpp cbcmac.cpp channels.cpp cryptlib.cpp des.cpp dessp.cpp dh.cpp dll.cpp dsa.cpp ec2n.cpp eccrypto.cpp ecp.cpp eprecomp.cpp files.cpp filters.cpp fips140.cpp fipstest.cpp gf2n.cpp gfpcrypt.cpp hex.cpp hmac.cpp integer.cpp iterhash.cpp misc.cpp modes.cpp modexppc.cpp mqueue.cpp nbtheory.cpp oaep.cpp osrng.cpp pch.cpp pkcspad.cpp pubkey.cpp queue.cpp randpool.cpp rdtables.cpp rijndael.cpp rng.cpp rsa.cpp sha.cpp simple.cpp skipjack.cpp strciphr.cpp trdlocal.cpp
DLLOBJS = $(DLLSRCS:.cpp=.export.o)
LIBIMPORTOBJS = $(LIBOBJS:.o=.import.o)
TESTIMPORTOBJS = $(TESTOBJS:.o=.import.o)
DLLTESTOBJS = dlltest.dllonly.o
lib: libcryptopp.a
all: cryptest.exe
test: cryptest.exe
cryptest.exe v
install: lib
$(CP) *.h include\cryptopp
$(CP) *.a lib
clean:
del cryptest.exe libcryptopp.a $(LIBOBJS) $(TESTOBJS) cryptopp.dll libcryptopp.dll.a libcryptopp.import.a cryptest.import.exe dlltest.exe $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS)
libcryptopp.a: $(LIBOBJS)
$(AR) $(ARFLAGS) $# $(LIBOBJS)
libcryptopp.so: $(LIBOBJS)
$(CXX) -shared -o $# $(LIBOBJS)
cryptest.exe: libcryptopp.a $(TESTOBJS)
$(CXX) -o $# $(CXXFLAGS) $(TESTOBJS) -L. -lcryptopp $(LDFLAGS) $(LDLIBS)
nolib: $(OBJS) # makes it faster to test changes
$(CXX) -o ct $(CXXFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS)
dll: cryptest.import.exe dlltest.exe
libcryptopp.dll: $(DLLOBJS)
$(CXX) -shared -o $# $(CXXFLAGS) $(DLLOBJS) $(LDFLAGS) $(LDLIBS) -Wl,--out-implib=libcryptopp.dll.a
libcryptopp.import.a: $(LIBIMPORTOBJS)
$(AR) $(ARFLAGS) $# $(LIBIMPORTOBJS)
$(RANLIB) $#
cryptest.import.exe: cryptopp.dll libcryptopp.import.a $(TESTIMPORTOBJS)
$(CXX) -o $# $(CXXFLAGS) $(TESTIMPORTOBJS) -L. -lcryptopp.dll -lcryptopp.import $(LDFLAGS) $(LDLIBS)
dlltest.exe: cryptopp.dll $(DLLTESTOBJS)
$(CXX) -o $# $(CXXFLAGS) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS)
%.dllonly.o : %.cpp
$(CXX) $(CXXFLAGS) -DCRYPTOPP_DLL_ONLY -c $< -o $#
%.import.o : %.cpp
$(CXX) $(CXXFLAGS) -DCRYPTOPP_IMPORTS -c $< -o $#
%.export.o : %.cpp
$(CXX) $(CXXFLAGS) -DCRYPTOPP_EXPORTS -c $< -o $#
%.o : %.cpp
$(CXX) $(CXXFLAGS) -c $<
Edit
To let it work I've forced the funcion memmove_s defined in misc.h (of cryptopp) to be defined inlined and now works also on windows xp (where memmove_s is not defined in msvcrt.dll).
Question: Can I change the mscvrt.dll of windows xp with one defined on Windows 7?
A way to build it is using qmake:
I removed GNUMakefile,
qmake -project
I open the pro file into QtCreator, changed TEMPLATE to lib and added ws2_32 to lib
The pro file now looks something this
TEMPLATE = lib
INCLUDEPATH += .
CONFIG -= qt
HEADERS += ...
SOURCES += ...
win32-g++ {
QMAKE_CXXFLAGS += -msse -msse2 -msse3 -mssse3
LIBS += -lws2_32
}
It seems work.
it's a try
put modexppc.cpp to your CRYPTOPP folder.
modexppc.cpp
// modexppc.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#ifndef CRYPTOPP_IMPORTS
#include "modexppc.h"
#include "asn.h"
NAMESPACE_BEGIN(CryptoPP)
NAMESPACE_END
#endif
I sent a patch fixing memmove_s in Windows XP to the MinGW developer team. It's been accepted and it will soon appear in the newer MinGW builds. By now it should be available on the CentOS 7 MinGW distribution and Fedora 21 MinGW.
Crypto++ 5.6.2 now builds fine without modification on MinGW, using make (and setting CC, CXX and PATH environment variables correctly). Tested on CentOS 7, which uses MinGW 4.9 IIRC.