CLion does not recognize CMakeLists.txt file - c

I am currently trying to set up CLion, as I like IntelliJ a lot, and I ran into this seemingly very basic problem:
CMake Error: The source directory "/cygdrive/c/.../untitled" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
This happens even when building a clean C project from scratch in CLion, where a CMakeLists.txt file is present in exactly that directory. I use cygwin64 as compiler and work on a Windows x64 machine. I guess /cygdrive/ before c is due to that.
Sorry to bother you guys with that basic stuff, but I simply cannot work it out. I know there are a lot of similar questions around, unfortunately that did not help me.

Related

Why Visual Studio Code can't compile my C code?

I have a problem which is: VSC can't compile my C code as the title said. I have looked for the problems and did all what was necessary:
installed msys
installed mingw
installed C/C++ extensions
added code runner
Yet the problem is still showing like this:
gcc.exe: error: name.c: No such file or directory
(Note that I'm an absolute beginner when it comes to using VSC and don't have any background in coding so I'd appreciate it if I get to know the solution by simple vocabulary :) )
It seems like your c file('name.c') is not located in your working directory.
Moving your c file to your project folder may solve your problem.
To check your working directory, choose terminal tab and type 'pwd'.

Viewing CPython Code in CLion

Sorry for a question that might appear stupid to more experienced developers: I am still a newcomer to C and C++.
I come from Python/Java development land and am trying to get a better insight into C and C++. I installed JetBrains CLion and cloned CPython mercurial repository. However when I started looking at the source code, I realized that Clion was highlighting a lot of constructs that seemed to be working. For instance:
Or
As far as I can see, Clion seems the have problem with the identation style of Python, C code, but once again, I might be wrong.
How Clion configurations can be altered for it to properly parse the CPython code?
CPython uses GNU Autotools for the build, but that toolset is not supported by CLion. See issues CPP-494 and CPP-193. CLion currently supports only one build system - CMake.
You can create your own CMakeLists.txt file and list the sources in there. This will help CLion to understand the structure of the source tree and allow it to find the headers etc:
cmake_minimum_required(VERSION 3.0)
project(cpython)
file(GLOB SOURCE_FILES
Python/*.c
Parser/*.c
Objects/*.c
Modules/*.c)
include_directories(Include)
add_executable(cpython ${SOURCE_FILES})
For the actual build, use standard build tools from command line. Alternatively, custom command can be added to CMakeLists.txt to call make. See add_custom_command for that.
As mentioned in the above answer you need a CMake Project to allow CLion to build Python.
In fact there is already a CMakeList.txt-files for CPython, that is maintained independently from the official sources:
https://github.com/python-cmake-buildsystem/python-cmake-buildsystem
I didn't test it with CLion but it should do the job...

Eclipse C/C++ does not want to run an app, outputting an Error -.-

Alright, hello guys. I've been using Eclipse Luna for some time now while programming in Java. Recently, due to school work, I decided to download the C/C++ for the eclipse as well. I have installed it and all went well. Then I wrote a simple programme and Eclipse will not run it.
Each time there is a pop up: Launch failed. Binary not found.
Also, Eclipse says there is the following error: Program "make"not found in PATH.
Now, I have tried everything to fix it. I'm using the MinGW. I also downloaded Msys.I added all the necesarry paths into the System enviroment variables and done the same thing in the Eclipse.
I went into the Window -- Preferences -- C/C++ -- New C/C++ project and under Binary Parsers selected the PE Windows Parser. I've tried other things as well, like adding the following line into the eclipse.ini as someone suggested:
-DMINGW_HOME=C:\Program Files (x86)\CodeBlocks\MinGW
Nothing seems to be working though and I sadly cannot run even the simplest of programs. Haalp, please.
Kind regards,
George.

How to use CUDA 6.0 with XCODE 5

My question may completely be a noob. Sorry, for that but I have been trying to compile my first Cuda code in Xcode and I'm lost where and how I could set up the IDE to invoke NVCC.
I installed the latest CUDA toolkit CUDA 6.0 and have even installed GCC 4.8 using brew. I have XCODE 5.5
When I run my code from XCODE all the directives like global are marked as unidentified.
I don't where and to change the settings to invoke NVCC. I will be really thankful, if anyone could help me with this.
Further, when I created the XCODE project, I created it as a C project. So, I placed the CUDA code in this C file, which is what is giving me the above mentioned errors. I tried to replace this .C file with a .cu file (just change the extension), which too failed badly - XCODE didn't even know what to do with the .cu files
COuld anyone please help me?
Thanks in Advance
I have given it a try. Although I have not completely succeeded I thought I'd post my progress here in hopes of helping others. The steps I took were inspired by this page.
Create a new Xcode project
Under Build Settings add a new user defined setting CC with the value /usr/local/cuda/bin/nvcc.
Add /usr/local/cuda/include to Header Search Paths under Build Settings.
Set Enable Modules (C and Objective-C) to No.
Add /usr/local/cuda/lib/libcuda.dylib to Link Binary With Libraries under Build Phases.
For any C files you create set their extension to .cu in the File Inspector, after you have done that you have to set the type of that file to C source to get syntax highlighting, by going to Editor->Syntax Coloring->C.
Problems with this setup:
- Xcode can't run the executable, at least nog if it is compiled for debugging. However you can make it copy the executable to some reasonable location and run it in the terminal.
- Whenever you try 'Build for running' sometimes Xcode magically destroys the whole project.

About linking files using Mac terminal

Okay here goes, I'm completely new at this, started learning the terminal just about 2 days ago. I'm slowly but surely getting the hang of it, now I'm stuck on this and I've been trying to fix it for a good hour. It's a rather simple question as I am a newby.
I have a C file in my desktop and a Header file in a folder in my desktop. I'm including that header in my C file. I have to link them (currently doing a tutorial, it tells me to link, but doesn't show me how).
You have a couple of options. First, you will need to install the software development environment - it's called Xcode. I think you can get it for free on the AppStore, if not Google it.
Then you need to decide if you want to develop and compile graphically in the Xcode Integrated Development Environment. If you do, start Xcode and create a new project and open your C file and change the "include path" to match the location of your header file. Then click "Build" and "Run"
If you want to do things at the commandline, you'll need to install "Xcode Command Line Tools" - Google it. That will give you a compiler. Then you can compile. I'm not certain which compiler you will get - it could be "llvm" or "gcc" or something else, but the command you are looking for will be something like:
gcc -o prog -I /path/to/HeaderFileFolder yoursourcecode.c
which will give you a program called "prog" that you can run by typing
./prog
You are likely confusing two different concepts. The "link" mentioned in the tutorial is probably talking about turning the compiled objects into a single executable. See http://www.cprogramming.com/compilingandlinking.html for an explanation of what linking means in this context.
What you've provided examples of doing is file system linking, which is totally unrelated.
Providing more details on the tutorial could help refine this answer.

Resources