I just installed vim-autoformat and astyle to format my c/c++ code inside vim. Everything seems to work, but it puts a newline to the end of the file everytime I run it. Even if there is one (or multiple). I tried to find the option in astyle -h and search the web, but didn't find anything. What do I do?
It looks like it's a bug in astyle that's been fixed. See http://astyle.sourceforge.net/subversion.html for help getting the latest development version. I'm using version 2.05 beta and it seems to be working correctly now.
Related
When I compile ThreadX+GUIX project of eclipse CDT with arm-none-eabi-gcc(Win7 64bit). It come out make (e=206). I found the same problems happened almost in JAVA development,but their solutions are not work for the CDT. Here is the compile error information:
I know the reason is because the GUIX has 1311 source files, and the compile and link operation command comes beyond the 8192 command limit. I have try to update the eclipse ,and move my workspace to the root of disk ,but the error still comes out. Now I don't know how to solve this problem. Anybody help me
If it is failing during linker/librarian stage, I modify the librarian command line to use an object_list.txt file to feed in the object file list, rather than specify them all on the command line. So something like this:
arm-elf-ar -r libguix.a #../object_list.txt
I use a python script to generate object_list.txt from the list of .c files, so it looks like this:
./common/src/gx_accordion_menu_create.o
./common/src/gx_accordion_menu_draw.o
./common/src/gx_accordion_menu_event_process.o
./common/src/gx_accordion_menu_position.o
./common/src/gx_animation_canvas_define.o
./common/src/gx_animation_complete.o
./common/src/gx_animation_create.o
./common/src/gx_animation_drag_disable.o
etc...
In your eclipse IDE there are settings to run your own custom linker command line rather than the default command line that isn't working.
Let me know if that helps you.
I'm new to Ubuntu and Linux, so I'm sorry if this question seems to be too stupid. I hoped to have a function that can automatically format my C++ codes, so I installed clang-format by the following terminal command:
sudo aptitude install clang-format
To make it work with Emacs, I searched on the Internet for a solution and modified my "~/.emacs" file, adding the following line:
(setq clang-format-executable "/usr/bin/clang-format-6.0")
Now in Emacs, when I used the command M-x clang-format-buffer or similar commands on a C++ file, it succeeded, but the source code didn't seem to be formatted at all (sorry that I can't directly post images for some reason):
https://i.stack.imgur.com/gNIvn.png
https://i.stack.imgur.com/eKLXl.png
Is there anything else I'm missing in setting up clang-format, or what's the proper way to set it up?
I appreciate any help!
I got it.
First, installing Clang-format this way was unnecessary. The proper way to do it was by using Emacs' package-install command.
package-install clang-format
Then I did this in the .emacs file:
(load "/usr/share/emacs/site-lisp/clang-format-6.0/clang-format.el")
Hope this helps anyone facing the same problem.
TL;DR: I want to change the version of LLDB that CLion (v2016.3.5) uses to LLDB v3.8.1. Can I do this? If so, how?
Longer explanation of the question:
CLion is a C++ IDE that I've been using for a few years now. Recently, they released version 2016.3.X. When they went from 2016.2 to 2016.3, they changed the "built in lldb" version from v3.8.1 to v3.9.0. This has caused a problem for me as v3.9.0 doesn't seem to want to work correctly.
When I, say, "print some_var_name" (while at a break point) I get an error (below):
Assertion failed: (D->getCachedLinkage() == LV.getLinkage()), function
getLVForDecl, file
/Applications/buildAgent/work/92515a49514b3993/lldb/llvm/tools/clang/lib/AST/Decl.cpp,
line 1360.
The source of this file can be found here: https://clang.llvm.org/doxygen/Decl_8cpp_source.html
My options are
(1) Figure out why that error is happening. Creating a simple "hello world"program and debugging seems to work. This tells me that it has something to do with my code base, I suppose. But I have over 20,000 lines of code. So figuring out what's doing it would be extremely time consuming. LLDB version 3.8.1 seems like a faster/easier fix since it was doing me just fine in the past.
(2) Use an old version of CLion (which, by default, utilizes LLDB version 3.8.1)
(3) Get the new(er) version(s) of CLion to use LLDB version 3.8.1.
Thanks for any help/guidance.
I assumed you could just enter the path in this preferences page:
I'm new to programming so I feel there is something simple I'm missing here.
I'm using the latest version of Mac and I've just installed Code::Blocks along with Xcode so I can use the gcc compiler.
I created a new "console application" project and the code for a hello world program shows up.
I built this code and it gave me 0 errors and 0 warnings so I thought it was off to a good start.
But when I go to run this code all I get is the following in my Terminal window:
*/Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/Ryan/Documents/C++ book stuff/SayHello/bin/Debug/SayHello
Ryan-McMullens-iMac:~ Ryan$ /Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/Ryan/Documents/C++ book stuff/SayHello/bin/Debug/SayHello
sh: /Users/Ryan/Documents/C++: No such file or directory
Process returned 127 (0x7F) execution time : 0.003 s
Press ENTER to continue.*
I've checked to make sure its using the gcc compiler. I've also tried creating a C++ directory in my documents folder but that didn't help.
Like I said, I feel like I'm just missing a step somewhere so any help would be really appreciated!
Thanks!
Try avoiding using '+' and spaces in the name of directories.
Many program don't handle escaping of pathnames when running external tools like compiler, linker or when calling the final executable.
Remove spaces from your path. It seems that codeblocks does not quote the paths, so every space will be introducing a new command or parameter. The problem here is this part:
C++ book
because it has a whitespace.
I recently saw this error on programs which used to work fine. I think that the error started appearing after I did a sudo apt-get upgrade, which might have upgraded the Qt libraries on my machine.
I've reproduced this error for newly created project containing this code:
QDesktopServices::openUrl(QUrl("/home/sashoalm/Has Spaces.txt"));
QDesktopServices::openUrl(QUrl::fromLocalFile("/home/sashoalm/Has Spaces.txt"));
This produces 2 message boxes saying the same - /home/sashoalm/Has%20Spaces.txt: No such file or directory. But the file exists - I've verified that, xdg-open "/home/sashoalm/Has Spaces.txt" works fine, for example.
Any workarounds? When did this bug happen? My OS is Debian Wheezy.
Edit: I checked Qt4's source code, and the relevant code is this (from qdesktopservices_x11.cpp):
return (QProcess::startDetached(client + QLatin1Char(' ') + QString::fromLatin1(url.toEncoded().constData())));
QUrl::toEncoded() returns the percent-encoded path as file:///home/sashoalm/Has%20Spaces.txt. What is strange is that there were no changes in that file save updating the copyright notices since at before 2011. So it can't be a change in Qt. But the command issued by QDesktopServices::openUrl() is xdg-open file:///home/sashoalm/Has%20Spaces.txt, and that doesn't work on my computer. Perhaps it used to work before, and an update to xdg-open itself broke it? Does anyone know if xdg-open should handle file:/// with percent encoding?
on Qt5
QDesktopServices::openUrl(QUrl::fromLocalFile("/home/sashoalm/Has Spaces.txt"));
worked just fine. I was having the same problem when loading the file purely from a QUrl like the first line
QDesktopServices::openUrl(QUrl("/home/sashoalm/Has Spaces.txt"));
but when used the QUrl::fromLocalFile it just did the thing
Either escape the space with \
QUrl("/home/sashoalm/Has\ Spaces.txt")
or add quotes to the path: -
QUrl("\"/home/sashoalm/Has Spaces\"")