Вместо использования больших IDE я хотел попробовать свой первый опыт работы с make-файлами. Не зная многого о make-файлах, я нашел пример и попытался адаптировать его к своему проекту.
Make-файл выглядит следующим образом:
#This is an easier to use and modify makefile, but it is slightly more difficult to read than the simple one:
#
# 'make depend' uses makedepend to automatically generate dependencies
# (dependencies are added to end of Makefile)
# 'make' build executable file 'mycc'
# 'make clean' removes all .o and executable files
#
# define the C compiler to use
#CC = gcc
#CC = "C:\MinGW\bin\g++.exe"
CXX = "C:\MinGW\bin\g++.exe"
# define any compile-time flags
#CPPFLAGS = -Wall -g -std=c++11
CXXFLAGS = -Wall -g -std=c++11
# define any directories containing header files other than /usr/include
#
#INCLUDES = -I/home/newhall/include -I../include
INCLUDES = -IC:\Users\k0cke\Desktop\TestMake\ATCCalib\inc
# define library paths in addition to /usr/lib
# if I wanted to include libraries not in /usr/lib I'd specify
# their path using -Lpath, something like:
#LFLAGS = -L/home/newhall/lib -L../lib
LFLAGS = -LC:\Users\k0cke\Desktop\TestMake\ATCCalib\lib
# define any libraries to link into executable:
# if I want to link in libraries (libx.so or libx.a) I use the -llibname
# option, something like (this will link in libmylib.so and libm.so:
#LIBS = -lmylib -lm
LIBS = -lvisa32
# define the C source files
#SRCS = emitter.c error.c init.c lexer.c main.c symbol.c parser.c
SRCS = main.cpp atcFlash.cpp measurements.cpp SerialCommunicationClass.cpp
# define the C object files
#
# This uses Suffix Replacement within a macro:
# $(name:string1=string2)
# For each word in 'name' replace 'string1' with 'string2'
# Below we are replacing the suffix .c of all words in the macro SRCS
# with the .o suffix
#
OBJS = $(SRCS:.c=.o)
# define the executable file
#MAIN = mycc
MAIN = apdCalib.exe
#
# The following part of the makefile is generic; it can be used to
# build any executable just by changing the definitions above and by
# deleting dependencies appended to the file from 'make depend'
#
.PHONY: depend clean
all: $(MAIN)
@echo Simple compiler named mycc has been compiled
$(MAIN): $(OBJS)
$(CXX) $(CXXFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LFLAGS) $(LIBS)
# this is a suffix replacement rule for building .o's from .c's
# it uses automatic variables $
Подробнее здесь: https://stackoverflow.com/questions/646 ... ry-windows
C++ mingw32 – создание неопределенных ссылок на библиотеку (Windows) ⇐ C++
Программы на C++. Форум разработчиков
1720457907
Anonymous
Вместо использования больших IDE я хотел попробовать свой первый опыт работы с make-файлами. Не зная многого о make-файлах, я нашел пример и попытался адаптировать его к своему проекту.
Make-файл выглядит следующим образом:
#This is an easier to use and modify makefile, but it is slightly more difficult to read than the simple one:
#
# 'make depend' uses makedepend to automatically generate dependencies
# (dependencies are added to end of Makefile)
# 'make' build executable file 'mycc'
# 'make clean' removes all .o and executable files
#
# define the C compiler to use
#CC = gcc
#CC = "C:\MinGW\bin\g++.exe"
CXX = "C:\MinGW\bin\g++.exe"
# define any compile-time flags
#CPPFLAGS = -Wall -g -std=c++11
CXXFLAGS = -Wall -g -std=c++11
# define any directories containing header files other than /usr/include
#
#INCLUDES = -I/home/newhall/include -I../include
INCLUDES = -IC:\Users\k0cke\Desktop\TestMake\ATCCalib\inc
# define library paths in addition to /usr/lib
# if I wanted to include libraries not in /usr/lib I'd specify
# their path using -Lpath, something like:
#LFLAGS = -L/home/newhall/lib -L../lib
LFLAGS = -LC:\Users\k0cke\Desktop\TestMake\ATCCalib\lib
# define any libraries to link into executable:
# if I want to link in libraries (libx.so or libx.a) I use the -llibname
# option, something like (this will link in libmylib.so and libm.so:
#LIBS = -lmylib -lm
LIBS = -lvisa32
# define the C source files
#SRCS = emitter.c error.c init.c lexer.c main.c symbol.c parser.c
SRCS = main.cpp atcFlash.cpp measurements.cpp SerialCommunicationClass.cpp
# define the C object files
#
# This uses Suffix Replacement within a macro:
# $(name:string1=string2)
# For each word in 'name' replace 'string1' with 'string2'
# Below we are replacing the suffix .c of all words in the macro SRCS
# with the .o suffix
#
OBJS = $(SRCS:.c=.o)
# define the executable file
#MAIN = mycc
MAIN = apdCalib.exe
#
# The following part of the makefile is generic; it can be used to
# build any executable just by changing the definitions above and by
# deleting dependencies appended to the file from 'make depend'
#
.PHONY: depend clean
all: $(MAIN)
@echo Simple compiler named mycc has been compiled
$(MAIN): $(OBJS)
$(CXX) $(CXXFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LFLAGS) $(LIBS)
# this is a suffix replacement rule for building .o's from .c's
# it uses automatic variables $
Подробнее здесь: [url]https://stackoverflow.com/questions/64697083/c-mingw32-make-undefined-references-to-library-windows[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия