Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7635501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:26:33+00:00 2026-05-31T07:26:33+00:00

I have a small Qt4 project which I want to build with cmake. It

  • 0

I have a small Qt4 project which I want to build with cmake.
It has a QTcpServer and a QThread, which both include the Q_OBJECT macro.
When I’m running make I always get an RCC Parse Error after generating qrc_tcpserver.cxx.
The exact failure output is:

[  9%] Generating qrc_tcpserver.cxx
RCC Parse Error: '/home/path/server/include/tcpserver.h' Line: 1 Column: 1 [error occurred while parsing element]
make[2]: *** [qrc_tcpserver.cxx] Fehler 1
make[1]: *** [CMakeFiles/TcpServer.dir/all] Fehler 2
make: *** [all] Fehler 2

My cmake file looks like this:

set(PROJECT_NAME TcpServer)
PROJECT(${PROJECT_NAME} )
cmake_minimum_required(VERSION 2.6)

# FOR QT4
find_package(Qt4 REQUIRED COMPONENTS QtCore QtNetwork) 

SET(CMAKE_PACKAGE_QTGUI FALSE)
SET( QT_WRAP_CPP TRUE )

set(QT_USE_QTXML TRUE)

# ENABLE WARNINGS
ADD_DEFINITIONS( -Wall )

#FOR GOOGLETEST
if(test)
    find_package(GTest REQUIRED)
    enable_testing()
endif()

set(QT_USE_QTNETWORK TRUE)
set(INCLUDES ${PROJECT_SOURCE_DIR}/include)

set(${PROJECT_NAME}_Qt_SRC
    ${INCLUDES}/tcpworkerthread.h
    ${INCLUDES}/tcpserver.h 
)

set(${PROJECT_NAME}_Qt_UI
)

set(${PROJECT_NAME}_Qt_RES
)

INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})

IF(QT_WRAP_CPP)
    MESSAGE("Wrap cpp!")
    QT4_WRAP_CPP(${PROJECT_NAME}_MOC_CPP ${${PROJECT_NAME}_Qt_SRC})
ENDIF(QT_WRAP_CPP)

QT4_WRAP_UI(${PROJECT_NAME}_UI_CPP ${${PROJECT_NAME}_Qt_UI})
QT4_ADD_RESOURCES(${PROJECT_NAME}_RES_H ${${PROJECT_NAME}_Qt_SRC})

if(test)
    include_directories(${GTEST_INCLUDE_DIRS} ${INCLUDES} ${QT_QTNETWORK_INCLUDE_DIR})
else()
    include_directories(${INCLUDES} ${QT_QTNETWORK_INCLUDE_DIR})
endif()

if(test)
    set(${PROJECT_NAME}_SRC_TEST
        src_test/main.cpp
        src_test/tcpservertest.cpp
        src_test/tcpworkerthreadtest.cpp
)
    set(PROJECT_TEST_NAME "${PROJECT_NAME}_test")
    set(${PROJECT_NAME}_SRC
        src/tcpserver.cpp
        src/tcpworkerthread.cpp
    )
else()
    set(${PROJECT_NAME}_SRC
        main.cpp
        src/tcpserver.cpp
        src/tcpworkerthread.cpp
)
endif() 

set(${PROJECT_NAME}_LIB
    ${QT_LIBRARIES}
    ${QT_QTNETWORK_LIBRARIES}
)

if(test)
    add_library(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_SRC} )
    add_executable(${PROJECT_TEST_NAME} ${${PROJECT_NAME}_SRC_TEST})
    target_link_libraries(${PROJECT_TEST_NAME} ${PROJECT_NAME} ${${PROJECT_NAME}_LIB} ${GTEST_BOTH_LIBRARIES} pthread)
    add_test(${PROJECT_TEST_NAME} ${PROJECT_TEST_NAME})
else()
    add_executable( ${PROJECT_NAME} ${${PROJECT_NAME}_SRC} ${${PROJECT_NAME}_MOC_CPP} ${${PROJECT_NAME}_UI_CPP} ${${PROJECT_NAME}_RES_H}) 
    target_link_libraries( ${PROJECT_NAME} ${${PROJECT_NAME}_LIB} )
endif()

I execute it without test variable, so this is set to false(I use it for generating gtest, which is not so important for me, just for playing around).

Any idea where my failure is?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:26:35+00:00Added an answer on May 31, 2026 at 7:26 am

    I’m not very familar with CMake, but it seems you’re feeding a wrong list of files to QT4_ADD_RESOURCES.

    The line

    QT4_ADD_RESOURCES(${PROJECT_NAME}_RES_H ${${PROJECT_NAME}_Qt_SRC})
    

    should probably be

    QT4_ADD_RESOURCES(${PROJECT_NAME}_RES_H ${${PROJECT_NAME}_Qt_RES})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have small PHP script which has $query = SELECT MAX(id) FROM `dbs`; //query
I'm new to CMake. Therefore, I have several questions which I don't want to
I have small page which has label, DropDownList and a submit button. <div> <asp:label
I have small script in bash, which is generating graphs via gnuplot. Everything works
I have small function which will recolor pixels in a Bitmap from a given
I have small Asp MVC 3 project where I need to create link to
We have small class, that has a related class class Car has_one :engine, :dependent
I have small project consisting of one maven project and two maven modules. One
I have small problem with mysql. I have data in table and I want
I have small solution, startup project dll project. In the dll project i have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.