Can someone share their compiler settings .. CLANG...toolchain from CodeBlocks ?
Solution
Edit in retrospect
... Can I change the execute mode (chmod) on a particular hard drive partition?
Short term solution ... execute from the home directory
Since I only have comments below I am not sure I can mark an answer.
I will leave my misunderstanding below.
I am on Linux Mint
Partial Success .... Clang does appear to examine and compile code.
Cleaned "test200 - Debug"
-------------- Build: Debug in test200 (compiler: Clang Hand Labor)---------------
clang++ -Wall -fexceptions -g -c "/media/transcend/Seagate Replica/cpp2011/test200/test200/main.cpp" -o obj/Debug/main.o
clang++ -o bin/Debug/test200 obj/Debug/main.o
Output size is 27.32 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds)
Console Output (typed by Hand .... I cannot copy from tiny console of CodeBlocks)
This is the !!!Error!! ... Just cout << "Hello"
elided
sh: 1: /path/st200 permission denied
returned 126
Compiler Settings in CodeBlocks IDE
C..clang
C++ clang++
Linker clang++
Linker for static ... ar
Resource Compiler ... nothing
make program ...........make
I used Software Manager of Linux for CodeBlocks IDE
There was no CLANG options present ... this fact makes me think I have something old
I copied the GCC Settings and typed clang and clang++
Thanks
Build Log Elided
clang++ -Wall -fexceptions -g -I/usr/lib/llvm-3.2/include elided -Wcast-qual -c "/media/transcend2020/Seagate Replica/cpp2011/test200/test200/main.cpp" -o obj/Debug/main.o
clang++ -o bin/Debug/test200 obj/Debug/main.o -lLLVMAsmParser elided -L/usr/lib/llvm-3.2/lib -lpthread -lffi -ldl -lm
Output size is 51.20 KB
Related
When I build a Release C++ project in NetBeans, it automatically configures it with the -O2 option.
I don't see anywhere in the compiler options where I can override this value. I know it's set to -O2 because I can see the cmdlines it uses in the Build window: g++ -O2 ...
If I add -O1 into the "Additional Otions" within the compiler settings it doesn't honour it because the cmdline now becomes g++ -O1 -O2 ... and so the -O2 supersedes my own setting.
So, where in the IDE can I set the -O optimization level compile setting?
I am using GNU compile tools on Linux if that makes any difference.
I finally found the solution by exploring a bit more. In the dialog from the OP there is the option, 'Development Mode' which is currently set to 'Release'. There are a number of options under there and each of those correspond to different optimization levels and/or debug output compile flags:
No Flags -c
Debug -c -g
Performance Debug -c -g -O
Test Coverage -g -c
Diagnosable Release -c -g -O2
Release -c -O2
Performance Release -c -O3
Although there doesn't seem to be an option for -O1, that's basically the intended way for you to select different optimization levels in NetBeans.
Please look at the nbproject/Makefile-Release.mk file.
nekto#ubuntu:~/host/ex/dt-netbeans-samples-cpp-Welcome$ grep -r O2 *
nbproject/Makefile-Release.mk: $(COMPILE.cc) -O2 -MMD -MP -MF "$#.d" -o ${OBJECTDIR}/welcome.o welcome.cc
It looks like the -O2 option presence in the Release configuration is the default and unchangeable, however you always can create your own build configuration (and you did as I see).
Each build configuration has its own nbproject/Makefile-<configuration name>.mk file, which contains following lines:
# CC Compiler Flags
CCFLAGS=-O1
CXXFLAGS=-O1
I've created a new configuration, made it active, and set the -O1 option above from the NetBeans properties pop-up window, C++ Compiler -> Additional Options, and my compilation line didn't contain the -O2 option. My Additional Options panel is below:
I have just installed codeblock and seems my all breakpoints are ignored. I have checked that I have unchecked "strip" and after I see the full compile command I find there is no flag as -s, but still.
This is the first time that I use ubuntu and codeblock and maybe I have overlooked something obvious. Thanks for any help.
-------------- Build: Debug in matrix ---------------
g++ -Wall -g -Wall -g -fexceptions -c /home/ubuntu/Documents/C++/matrix/main.cpp -o obj/Debug/main.o
g++ -o bin/Debug/matrix obj/Debug/main.o
Output size is 160.36 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
Have you actually set-up a debugger, which you can see in the Active debuggers menu? (see screenshot)
If you actually have a debugger, you can start a debugging session from the debug menu. (or use F8 if you have the same shortcuts)
Screenshot link: Debug Menu
Can't post image directly here, since my rep is to low.
I’m running Netbeans 7.4 on Mavericks. In order to be able to use gdb, compilation with the -ggdb flag seems to be necessary. However, even though I specify it through the Project’s Properties/Additional Options wizard, Netbeans also emits -g during compilation. Unfortunately, it turns out that this behavior has an adverse effect when the debugging session commences. Is there any way to force Netbeans not to also emit -g?
Output during compilation:
g++ -m64 -ggdb -c -g -Werror -std=c++11 -MMD -MP -MF "build/Debug/macport_GNU-MacOSX/main.o.d" -o build/Debug/macport_GNU-MacOSX/main.o main.cpp
mkdir -p dist/Debug/macport_GNU-MacOSX
g++ -m64 -ggdb -o dist/Debug/macport_GNU-MacOSX/executable build/Debug/macport_GNU-MacOSX/main.o
Alexander.Simon#oracle.com responded here [1] to set "Development Mode" to "No Flags", then specify -ggdb in the "Additional Options".
1 - https://netbeans.org/projects/cnd/lists/users/archive/2014-02/message/12
I am trying to compile a single .cpp file separately from the build process.
If I do a full build then the compile step outputs to the directory configured when creating the project.
However if I just ask for a compile I end up with the object file going to the same directory as the source, and even worse it goes on and links the object file to the executable when it is supposedly doing a compile.
Note I am compiling with clang++ for C++11, but I don't think that has any barring on why it is calling Clang++.exe a second time for linking which has not been requested.
Edit1
When building it does this
-------------- Build: Debug in GOTW (compiler: GNU GCC Compiler)---------------
clang++.exe -Wall -fexceptions -g -std=c++11 -stdlib=libstdc++ -c
C:\Work\test\2010\C++11\CLang\GOTW\gotw.cpp -o obj\Debug\GOTW.o
clang++.exe -o bin\Debug\GOTW.exe obj\Debug\GOTW.o
Output size is 203.50 KB
Process terminated with status 0 (0 minutes, 11 seconds)
0 errors, 6 warnings (0 minutes, 11 seconds)
Yet when Compile Current File is performed it does this:
clang++.exe -std=c++11 -stdlib=libstdc++ -c GOTW.cpp -o GOTW.o
1 warning generated.
clang++.exe -o GOTW.exe GOTW.o
I don't understand why it is outputting the second step, and also how to get it to use the obj and bin directories like the build does
Use the -c option.
-c
Run all of the above, plus the assembler, generating a target ".o"
object file.
g++ -c *.cpp
it compiles .cpp into .o
I have a warning involving /usr/local/lib/gcc/x86_64-apple-darwin10.8.0/4.6.4/libgcc.a. I was trying to compile a C++ project using a Makefile, which shows the following:
executeit: bplustree.o nonleafnode.o leafnode.o
g++ -o executeit bplustree.o nonleafnode.o leafnode.o
bplustree.o: bplustree.cpp
g++ -g -c bplustree.cpp
nonleafnode.o: nonleafnode.h nonleafnode.cpp
g++ -g -c nonleafnode.h nonleafnode.cpp
leafnode.o: leafnode.h leafnode.cpp
g++ -g -c leafnode.h leafnode.cpp
clean:
rm executeit bplustree.o nonleafnode.o leafnode.o
When I invoke "make", I get the following output in Terminal:
g++ -g -c bplustree.cpp
g++ -g -c nonleafnode.h nonleafnode.cpp
g++ -g -c leafnode.h leafnode.cpp
g++ -o executeit bplustree.o nonleafnode.o leafnode.o
ld: warning: in /usr/local/lib/gcc/x86_64-apple-darwin10.8.0/4.6.4/libgcc.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
As you can see, I have gcc version 4.6.4. I am not sure if this warning is a threat to the project working in any way, but I would like to know what this warning means and if it is a threat. It would be nice if I can do something to remove it, too. Thank you.
I have Mac OS X Version 10.6.8. The file /usr/local/lib/gcc/x86_64-apple-darwin10.8.0/4.6.4/libgcc.a has "10.8.0", and this version of gcc I installed must have screwed me over. I don't know if I can remove this warning by installing OS X 10.8.0, but I will consider this question answered for now. Thank you.