Comments (4)
Hello
extern "C" is used when fpc.c is compiled as c but then included by a c++ application
To make it work you should either compile fpc.c seperately as c application
gcc -Wall -O2 -DNDEBUG -c fpc.c -o fpc.o
and then link it with c++
g++ -Wall -O2 -DNDEBUG cli.c fpc.o -o fpc
or if you want to compile both with g++ you should remove extern "C"
from fpc.
Also you should notice that fpc.c uses variable length arrays that they are not present in standard c++. They are included only in standard c (C99 and above). So it can be compiled as c++ only with compilers that support variable length arrays as extension like g++ and clang++.
from fpc.
Thanks for the info. I made a static lib Makefile for fpc.c by using g++ and it works. Probably will use it instead of just using the #include "fpc.c" trick.
from fpc.
Makefile for libfpc.a:
CC = g++
TARGET = libfpc.a
CFLAGS= -pipe -fPIC -O3 -g -Wall -c -march=native -mtune=native
INC = -I./
OBJ_DIR=./obj
OUT_DIR=./
SRC_DIR=./
#Lib for fpc.c
FILES = $(SRC_DIR)/fpc.c
ar -rcs -o
#Compiling every *.c to *.o
dirmake:
@mkdir -p $(OUT_DIR)
@mkdir -p $(OBJ_DIR)
clean:
rm -f
rebuild: clean build
from fpc.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fpc.