How to introduce the Network module in Qt6

October 1, 2023, Sunday morning

October 2, 2023, Monday afternoon

first update


Table of contents


 

If you are using CMake

find_package(Qt6 COMPONENTS Network REQUIRED) 
target_link_libraries(mytarget PRIVATE Qt6::Network)

Qt Console Application

In actual use, I found the following points to pay attention to:

1. Replace "mytarget" with the project name

2. Remove “PRIVATE”

3. find_package and target_link_libraries should be written separately

Qt Widgets Application

In actual use, I found the following points to pay attention to:

1. Replace "mytarget" with the project name

2. Unlike Console, PRIVATE must be retained at this time

3. find_package and target_link_libraries should be written separately

If you are using qmake

QT += network

Guess you like

Origin blog.csdn.net/m0_61629312/article/details/133445578