Re: [fltk.general] incomplete Circle drawn with classes from PPP

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: incomplete Circle drawn with classes from PPP ken williams 02:07 Apr 29 top right image
 
Thank you Albrecht and Ian, now everything makes sense!
so silly to think I should create folders and move files around
when "make install" does that on the path I created with CMAKE_INSTALL_PREFIX

I was able to test both 1.4.0 and 1.3.5 and compile both with one command and the Makefile
I learned a lot, thank you!

I created a file with the summary of this post, but I can't attach it so I'll post it below.
Maybe it's worth adding it on Github to help other beginners like me who maybe come from Dr. S book
and have no idea where to install, how to install or how to compile with Makefiles.

##################################### FLTK install & use ################################################################

download FLTK in the home folder:
    git clone https://github.com/fltk/fltk.git fltk-1.4.0

the following sequence will install FLTK in the home path (/home/ken01/dev/fltk-1.4.0)
installing FLTK in the home path is preferable when you want to test multiple versions

in the/home/ken01/dev/fltk-1.4.0 folder:
    mkdir build
    cd build
    cmake -D CMAKE_INSTALL_PREFIX=/home/ken01/dev/fltk-1.4.0 -D 'CMAKE_BUILD_TYPE=Debug' -D FLTK_BUILD_EXAMPLES=ON ..
    make
    make install

while this will install FLTK on the system (the default path is /usr/local or /usr)
    mkdir build
    cd build
    cmake -D 'CMAKE_BUILD_TYPE=Debug' -D FLTK_BUILD_EXAMPLES=ON ..
    make 
    make install
    
for those coming from Programming Principles and Practice    
when you want to compile a program that uses FLTK you can use either

this command:
g++ -w -Wall -std=c++14 Graph.cpp Window.cpp GUI.cpp Simple_window.cpp 13.12_circle.cpp `/home/ken01/dev/fltk-1.4.0/bin/fltk-config --cxxflags --ldflags --use-images` -o 13.12_circle.bin

or a Makefile:
(for more complex programs)

################ template makefile ##############
# Set up the paths to the folders we will read files from
PATH_1 := /path/to/some/files
PATH_2 := /path/to/other/files

# Where is the fltk-config we plan to use?
FLTK_CNF := /full/path/to/my/fltk-config

# We don't know what compiler to use to build fltk on this machine - but fltk-config does...
CC  := $(shell $(FLTK_CNF) --cc)
CXX := $(shell $(FLTK_CNF) --cxx)

# Set the flags for compiler: fltk-config knows the basic settings, then we can add our own...
CFLAGS   := $(shell $(FLTK_CNF) --cflags) -Wall -O3 -I$(PATH_1) -I$(PATH_2)
CXXFLAGS := $(shell $(FLTK_CNF) --cxxflags) -Wall -O3 -I$(PATH_1) -I$(PATH_2)

# We don't know what libraries to link with: fltk-config does... Throw in the kitchen sink...
LINKFLTK := $(shell $(FLTK_CNF) --use-gl --use-images --ldstaticflags)

# Possible steps to run after linking...
STRIP      := strip
POSTBUILD  := $(FLTK_CNF) --post # May be required on OSX (does nothing on other platforms, so safe to call)


# Define what your target application is called
TARGET := MyApp
# What objects go into the target application
OBJECTS := file1.o file2.o

all: $(TARGET)

# Define how to build the various object files...

file1.o: $(PATH_1)/file1.c $(PATH_1)/file1.h  # a "plain" C file from PATH_1
$(CC) -c $< -o $@ $(CCFLAGS)

file2.o: $(PATH_2)/file2.cxx $(PATH_2)/file2.h $(PATH_1)/file1.h  # a C++ source file from PATH_2
$(CXX) -c $< -o $@ $(CXXFLAGS)

# Now define how to link the final app
MyApp:  $(OBJECTS)
$(CXX) -o $@ $(OBJECTS) $(LINKFLTK)
$(STRIP) $@
$(POSTBUILD) $@  # only required on OSX, but we call it anyway for portability

clean:
rm -f $(TARGET)
rm -f $(OBJECTS)

############### end #################

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/2a0dc56b-fff7-4184-901a-1a9c395f32fbn%40googlegroups.com.
Direct Link to Message ]
 
bottom left image   bottom right image
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2022 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.