CLion can't create classes

Answered

I'm having the same issue as this person from this stack overflow thread:

https://stackoverflow.com/questions/46673640/clion-cmake-no-rule-to-make-target

 

I create a project. Run main.cpp. Works successfully. Then I create a C++ class. Then I got this error:

mingw32-make.exe: *** No rule to make target 'test2'.  Stop.

 

Deleting the new class doesn't fix this error. Here's CMakeList.txt:

cmake_minimum_required(VERSION 3.9)
project(test2)

set(CMAKE_CXX_STANDARD 14)

add_executable(test2 main.cpp test2.cpp test2.h)
1
8 comments

Hi, Erik! Does the issue persist after Tools | CMake | Reset Cache and Reload Project?

0
Avatar
Permanently deleted user

Yes, it still persists.

0

Erik, unfortunately, I can't reproduce the issue with CLion 2018.1 and MinGW (version: w64 5.0):

What CLion version do you use? Could you please try the latest stable (2018.1.1)?

Do you use bundled CMake or custom? Is it possible to record a screencast illustrating the issue? Please also share the whole error message.

0
Avatar
Permanently deleted user

Thanks Anna,

 

I clicked on "checked for updates" in the "help" drop down menu. Updated to the latest stable version, and that fixed the problem.

0
Avatar
Permanently deleted user

Hello, I am having this same issue and have tried everything on here and updated my CLion version to be 2018.3.4. Not sure what to do as have tested this with new projects and run the hello world test program. That works but then I just made an empty class and it then stops to work giving this error.

0
Avatar
Permanently deleted user

It’s been about a year since I had this issue, but if I recall correctly, moving the project onto my C Drive might’ve actually solved the issue instead of the update. My project was originally on a flash drive which may have been the original source of the problem

1
Avatar
Permanently deleted user

Ahh, thanks so much. I am also running off a flash drive. Now running from my C drive and all working.

0

We've made some test on our side. According to the testing results:

  1. The problem is reproducible in CLion with MinGW.
  2. The problem is reproducible outside CLion (building the target in the Command Prompt) with MinGW.
  3. The problem is not reproducible in CLion with MinGW-64.

So it looks like a MinGW-related issue. A workaround is to use MinGW-64.

1

Please sign in to leave a comment.