Символ посмотрите ошибки в сборке CmakeC++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Символ посмотрите ошибки в сборке Cmake

Сообщение Anonymous »

В настоящее время я делаю небольшой проект с намерением сделать неполную реализацию JPEG в долгосрочной перспективе. До этого я выполняю реализацию относительно более простого формата файла PNG. Ошибки, которые я получаю, следующие: < /p>

Код: Выделить всё

Undefined symbols for architecture arm64:
"PNG::verify_png_header(std::__1::bitset const&)", referenced from:
_main in main.cpp.o
"PNG::PNG::PNG(std::__1::basic_string_view)", referenced from:
_main in main.cpp.o
< /code>
Структура файла следующая: < /p>
CMakeLists.txt
src/
CMakeLists.txt
main.cpp
png/
CMakeLists.txt
png_types.cpp
png.cpp
common/
common.cpp
CMakeLists.txt
lib/
include/
png/
png_types.hpp
png.hpp
common/
common.hpp
debug/
release/
< /code>
для настройки сборки I Do: < /p>
cd debug
cmake -DCMAKE_BUILD_TYPE=debug ..
cmake --build .
< /code>
Содержимое файлов cmakelists.txt следующее: < /p>
cmakelists.txt:
# CMakeLists.txt

cmake_minimum_required(VERSION 3.30.5)

project(parse_jpeg)

#CMake includes
include(CTest)
enable_testing()

# Required packages
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)

# Compiler info
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_CXX_STANDARD 23)

# Generate compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Setting project directories
set(INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/include)
set(TEST_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/tests/include ${INCLUDE_DIRS})

# Set output directories
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)

# Default compiler flags
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -Wconversion -pedantic -O0 -ggdb -fpic")
set(CMAKE_CXX_FLAGS_RELEASE "-Werror -DNDEBUG -march=native -Wall -Wextra -pedantic -Wconversion -O3 -fpic")

# Important subdirectories
add_subdirectory(src)
add_subdirectory(tests)

message(STATUS "LINK_LIBS: ${LINK_LIBS}")
add_executable(main src/main.cpp)

target_link_libraries(main PRIVATE ${LINK_LIBS})
target_include_directories(main PRIVATE ${INCLUDE_DIRS})
src/cmakelists.txt:

Код: Выделить всё

# src/CMakeLists.txt

# Add subdirectories
add_subdirectory(common)
add_subdirectory(png)

# Pass lists back to parent scope
set(LINK_LIBS ${LINK_LIBS} PARENT_SCOPE)
set(PNG_SOURCES ${PNG_SOURCES} PARENT_SCOPE)
set(COMMON_SOURCES ${COMMON_SOURCES} PARENT_SCOPE)
src/png/cmakelists.txt:

Код: Выделить всё

# src/png/CMakeLists.txt

set(PNG_SOURCES png_types.cpp png.cpp)

message(STATUS "Creating PNG shared library, sources:  ${PNG_SOURCES}")
add_library(PNG SHARED ${PNG_SOURCES})
target_include_directories(PNG PRIVATE ${INCLUDE_DIRS})

set(LINK_LIBS ${LINK_LIBS} PNG PARENT_SCOPE)
set(PNG_SOURCES ${PNG_SOURCES} PARENT_SCOPE)
src/common/cmakelists.txt
# src/common/CMakeLists.txt

set(COMMON_SOURCES common.cpp)

message(STATUS "Creating COMMON shared library, sources: ${COMMON_SOURCES}")
add_library(COMMON SHARED ${COMMON_SOURCES})
target_include_directories(COMMON PRIVATE ${INCLUDE_DIRS})

set(LINK_LIBS ${LINK_LIBS} COMMON PARENT_SCOPE)
set(COMMON_SOURCES ${COMMON_SOURCES} PARENT_SCOPE)
< /code>
Это личный проект, но я на рабочем устройстве, поэтому я не могу показать полные пути файла и т. Д.// include/common/common.hpp
#pragma once

#define DELETE_MOVE( class ) \
class( class && ) = delete; \
class & operator=( class && ) = delete;

#define DELETE_COPY( class ) \
class( const class & ) = delete; \
class & operator=( const class & ) = delete;

#define COLD [[unlikely]]
< /code>
// src/common/common.cpp
#include "common/common.hpp"
// This file is empty at the moment
< /code>
// include/png/png_types.hpp
#pragma once

#include "common/common.hpp"

#include
#include
#include
#include
#include

namespace PNG
{

// Chunk types underlying values are set to their hex values.
enum class png_chunk_t : std::uint32_t {
// WARNING:
// INVALID chunk type is non-specification, i.e internal only
INVALID = 0,

// CRITICAL CHUNKS:
/* IHDR:
* Contains in the following order:
* - Image width (4 bytes).
* - Image height (4 bytes).
* - Bit depth (1 byte, value 1/2/3/8/16)
* - Color type (1 byte, value 0/2/3/4/6)
* - Compression method (1 byte, value 0)
* - Filter method (1 byte, value 0)
* - Interlace method (1 byte, value 0 "no interlace"/1 "Adam7 interlace")
* 13 bits total.
* "bit depth" is defined as:
* number of bits per sample or palette index (not per pixel)
* */
IHDR = 0x49'48'44'52,
/* PLTE:
* Contains the palette, a list of colours
* Essential for colour type 3 (indexed colour).
* Optional for colour types 2 & 6 (truecolour & truecolour with alpha) *
* Must not appear for colour types 0 & 4 (grayscale & grayscale with alpha)
* * */
PLTE = 0x50'4c'54'45,
/* IDAT:
* Contains image. May be split between multiple IDAT chunks.
* Splitting increases filesize but allows PNG to be generated in a
* streaming manner. IDAT chunk contains actual image data, the output of
* the compression algorithm.
* */
IDAT = 0x49'44'41'54,
/* IEND:
* Marks end of image
* */
IEND = 0x49'45'4e'44,

// ANCILLARY CHUNKS:
bKGD = 0x62'4b'47'44, // def. background colour
cHRM =
0x63'48'52'4d, // chromaticity coords of display primaries & white point
dSIG = 0x64'53'49'47, // Storing digital signatures
eXIF = 0x65'58'49'46, // Stores Exif metadata
// Specifies gamma. Contains 4 bytes, value = gamma * 100000
// e.g 1/3.4 -> 29411.7647... -> 29412 for storage
gAMA = 0x67'41'4d'41,
hIST = 0x68'49'53'54, // Stores histogram, or tot. amount of each colour in
// image
iCCP = 0x69'43'43'50, // ICC colour profile
iTXt = 0x69'54'58'74, // Contains keyword & UTF8 text, see
// https://en.wikipedia.org/wiki/Portable_ ... ile_format
pHYs =
0x70'48'59'73, // Intended pixel sz. px/unit x-axis (4 bytes), px/unit
// y-axis (4
// bytes), unit specifier (1 byte)
sBIT = 0x73'42'49'54, // (Significant bits) shows colour-accuracy of source
// data (1-13
// bytes)
sPLT = 0x73'50'4c'54, // Suggest palette if fulle colour range unavailable
sRGB = 0x73'52'47'42, // Indicates sRGB colour space is used. Contains 1
// byte, 4 values
// (0/1/2/3) are defined for rendering intent
sTER =
0x73'54'45'52, // Stereo-image indicator chunk for stereoscopic images
/* tEXt:
* Stores text.
* One key-value pair per chunk.
* The "key" must be between 1-79 chars long.
* The separator is a null character.
* The "value" can be between 0-(MAX_CHUNK_SZ - len(key) - len(separator))
* Neither "key" or "value" can contain null chars.
* Leading or trailing spaces also disallowed.
* */
tEXt = 0x74'45'58'74,
tIME = 0x74'49'4d'45, // Stores time of last change.
/* tRNS:
* Contains transparency information.
* For indexed images, stores alhpha channel vals for 1 or more palette
* entries. For truecolour & grayscale images, stores single px val that is
* to be regarded as transparent.
* */
tRNS = 0x74'52'4e'53,
zTXt = 0x7a'54'58'74 // Contains compressed text (& compression method
// marker). Same
// limits
// as tEXt

/* Lower case first letter = non-critical
* Lower case last letter = safe to copy, even if application doesn't
* understand it.*/
};

enum class png_pixel_format_t {
grayscale,
truecolor = 2,
indexed = 3,
alpha_grayscale = 4,
alpha_truecolor = 6
};

std::ostream & operator

Подробнее здесь: https://stackoverflow.com/questions/795 ... make-build
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»