How to decrease build times / speed up compile time in Xcode?

Often, the largest thing you can do is to control your inclusion of header files. Including “extra” header files in source code dramatically slows down the compilation. This also tends to increase the time required for dependency checking. Also, using forward declaration instead of having headers include other headers can dramatically reduce the number of … Read more

How do header and source files in C work?

Converting C source code files to an executable program is normally done in two steps: compiling and linking. First, the compiler converts the source code to object files (*.o). Then, the linker takes these object files, together with statically-linked libraries and creates an executable program. In the first step, the compiler takes a compilation unit, … Read more

How to compile/install node.js(could not configure a cxx compiler!) (Ubuntu).

One-liner to install all needed dependencies(curl and git are not really needed, but are very useful and also needed if you install via nvm). sudo apt-get install build-essential libssl-dev curl git-core Last two dependencies are not always needed, but installing them is really usefull anyway and you probably need it later anyway. To only install … Read more

Why do you need to recompile C/C++ for each OS? [duplicate]

Don’t we target the CPU architecture/instruction set when compiling a C/C++ program? No, you don’t. I mean yes, you are compiling for a CPU instruction set. But that’s not all compilation is. Consider the simplest “Hello, world!” program. All it does is call printf, right? But there’s no “printf” instruction set opcode. So… what exactly … Read more

Why does not the Application_Start() event fire when I debug my ASP.NET MVC app?

I found the following answer on forums.asp.net: Are you using IIS7 as the server or the built-in web server? I noticed when using IIS7 that if you start the debugger, let a page come up, then change Global.asax (the markup file, not code-behind) while the debugger is still running, then refresh the page, breakpoints in … Read more

Compiler stops optimizing unused string away when adding characters

This is due to the small string optimization. When the string data is less than or equal 16 characters, including the null terminator, it is stored in a buffer local to the std::string object itself. Otherwise, it allocates memory on the heap and stores the data over there. The first string “ABCDEFGHIJKLMNO” plus the null … Read more

Scala double definition (2 methods have the same type erasure)

I like Michael Krämer’s idea to use implicits, but I think it can be applied more directly: case class IntList(list: List[Int]) case class StringList(list: List[String]) implicit def il(list: List[Int]) = IntList(list) implicit def sl(list: List[String]) = StringList(list) def foo(i: IntList) { println(“Int: ” + i.list)} def foo(s: StringList) { println(“String: ” + s.list)} I think … Read more

Can I use Qt without qmake or Qt Creator?

Sure you can. Although it is more convenient with qmake or CMake, you can do: CXXFLAGS += -Ipath_to_your_qt_includes LDFLAGS += -Lpath_to_your_qt_libs LDLIBS += -lqt-mt (for Qt3) or LDLIBS += -lQtCore -lQtGui (for Qt4, add what you need) my_prog: my_prog.cpp (in a makefile) Update – invoking moc: Quote from moc manpage: Here is a useful makefile … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)