I am trying to load my xcode project into textmate so that I can compile and run using the xcode bundle in textmate.
When I compile my project in XCode it works fine, but when I load it up into textmate and I try to compile and run using the XCode bundle I get C99 errors due to my for loop syntax.
Has anyone run into this situation before? My XCode project is of the "Command Line Tool" template and I selected the "C++ stdc++" type for the project.
EDIT: The error I am specifically getting is:
Error: 'for' loop initial declaration used outside c99 mode
on the following line:
for(int i = 0; i < value; i++){
Again, I am only getting that error when I tell the TextMate XCode bundle to build and run, but it works just fine if I load up the project in XCode. I am also referencing the OpenCL framework as well in the XCode project, but I'm not sure how that would cause something like this to occur.
Thanks!
You need to set your C dialect to C99, which is an update to the language, standardized in 1999, with slight differences from "ANSI C."
In Xcode:
Select either your project or target (whichever you deem appropriate for this setting change.)
Open the File menu and select Get Info.
Select the Build tab in the window that appears.
Find the "C Language Dialect" option and set it to C99.
Recompile.
An update for Xcode 4:
On the left panel, click on the project icon/Name
Look for 'C Language Dialect' under 'LLVM GCC 4.2 - Language'
Set it up C99 [-std=c99]
Related
MacOS Catalina 10.15.7, VSCode 1.64.2 (Universal) :I had the intellisense working for my project without problems, but then for whatever reason it has stopped working in some cases:
whenever I assign something to an 'auto variable', for example: auto val = (float)foo; I'd get intellisense error: int val: explicit type is missing ('int' assumed)C/C++(260).
Class enums are not recognised as they should, so I can't use EnumClass::Enum or get any enum-related autocomplete support.
Those are the most reoccuring problems, but I'd say the intellisense generally doesn't work properly.
I removed everything related to VSCode (using this: How to completely uninstall vscode on mac) and reinstalled with just C/C++ extention enabled and the problem persists. I have other people using the same setup with this project and they don't have this problem. I tried older versions of the extention without success aswell.
Is there anything I could try to get it back to work?
The issue seems to be that intellisense is using older c++ version for determining the syntax.
The way to fix this is to set to some newer version like c++17
Go to settings in your VSCode and search for Cpp Standard and from the dropdown select c++17 or any newer version that you use.
In case you follow JSON style settings, then search for following
"C_Cpp.default.cppStandard": "c++17"
Attaching the screenshot of the settings page
I follow the instruction and successfully build and run a C++ project with its Makefile. However I cannot see any live issue while I intentionally making syntax errors.
If I attempt to build files with issues, the issue navigator would display the issues while there is still no live issue pointing out which line occurs this issue.
I have tried the following possible solutions, but none of them works.
Turn on the "Show live issue" feature:
Turn on "Always search user path":
Delete the derived data in preference-location.
My Xcode live issue feature works fine for other projects(I just use the default target to build). My Xcode version is 8.2.1 and MacOS is 10.12.2.
My question is how to make Xcode show live issue when dealing with external build tools?
I’m trying to include openmp to my Xcode C++ project. I have changed my compiler in Xcode to LLVM GCC 4.2, added ”-fopenmp” as a CFlag and enabled OpenMP support in xcode as well. But it still says ”‘omp.h’ file not found” and i am unable to build the project. Does anyone know what could be wrong and how to fix this?
I have had the same problem. Try going to the project navigator using the panel at the left side. Select your project (the one with the blue icon), and a different main window appears. Here, click the relevant file under "Targets" and choose the "Build settings" and "All". Here, search for OpenMP. In my system, it shows up under "LLVM GCC 4.2 - Language". Set "Enable OpenMP Support" to Yes. This should make it work. Make sure to not manually #include "omp.h".
The weird thing is that I don't know how to do this "manually" (i.e. circumventing the built-in Xcode I approach described above).
I am trying to use C++11. After sifting through the internet I found that all I have to do is
right click on my project -> properties and under the "C++ standard" select c++ 11. When I run the program with C++ 11, I get this error "unrecognized command line option -std=c++11. One solution people have said is to add -g -std=c++0x in the "Additional Options" but then I get "unrecognized command line option -std=c++0x. I have downloaded gcc-4.7.1.tar.gz but I have no idea what to do with it.
Does anyone know how to get rid of this error or know how to make net beans compile with c++11?
bump your gcc version to 4.7+. c++0x is supported since gcc4.3 while c++11 is supported since gcc4.7
Steps to configure through Netbeans IDE:
Right click on project and goto properties
Go to Build -> C++Compiler
In right hand side panel there are few options
go to Basic options -> C++ Standard
change its value from C++ 11 to C++ 98
I have downloaded the latest Eclipse CDT release (Helios) and wanted to try my luck with some C++ programming (haven't done that in ages).
I tried to do the "Hello World" project, but I got stuck quite fast.
First thing - the #include <stdio.h> and #include <stdlib.h> got marked with an 'Unresolved Symbol' warning. So I found the place where I can add include paths and pointed it to these headers from the Visual Studio installation I have.
After that, it looked fine but:
I don't see compilation errors/warnings in the Problems tab.
I cannot run the code - I get 'Launch failed. Binary not found' error
My question is simple - what are the steps I really need to do to get my code compiled, linked and executed?
I tried looking for it on Eclipse's site, but didn't find any reference to that.
I'm making a guess here, that your are running on Windows, because that particular error seems to be a windows related one.
You seem to be missing the basic toolchain needed by the CDT to actually build the project. You need some files Before You Get Started. I suggest the mingw installer, as it is simple, and lets you actually build Windows compatible binaries.
Check out the link above, and then make sure your project links to the toolchain. Hope that helps.
A starting point could be:
File -> New -> c++ project
Type a name for the project, select Hello World c++ Project under Project Type and click Finish.
Right click on the project -> Run As -> Local C++ application (or just click the Run button on the toolbar).
I was getting the same error until I ran the "Build All" command. That command created two new folders, Debug and Release. Then when I clicked the "Debug" button, it asked me which one I wanted to run and I selected "Debug" and it ran perfectly.
It seems like the binary it couldn't find was created from the "Build All" command.