User forums > General (but related to Code::Blocks)

multiple cpp files using codeblocks

<< < (2/3) > >>

Seronis:
C::B supports multiple files just fine.  I have projects with between 6 and 600 files that C::B has never complained to me about.

you DID create a project first, didnt you?

ewww:
OK. What i mean is have a nice built-in configuration support for

mingw32-g++.exe first.cpp second.cpp -o output.dll -shared   -Wl,--dll -s

versus what we get currently by default:

mingw32-g++.exe -c first.cpp -o first.o
mingw32-g++.exe -c second.cpp -o second.o
mingw32-g++.exe -shared   -Wl,--dll  first. o second.o   -o output.dll -s

Isn't it what this thread was all about from the start?

oBFusCATed:

--- Quote from: ewww on March 12, 2010, 02:41:20 pm ---OK. What i mean is have a nice built-in configuration support for

mingw32-g++.exe first.cpp second.cpp -o output.dll -shared   -Wl,--dll -s

versus what we get currently by default:

mingw32-g++.exe -c first.cpp -o first.o
mingw32-g++.exe -c second.cpp -o second.o
mingw32-g++.exe -shared   -Wl,--dll  first. o second.o   -o output.dll -s

--- End quote ---
Why do you think the former way of compiling is better?
The latter scales very well on a quad-, octa-, n-core machine. Can you say the same for the former?


--- Quote ---Isn't it what this thread was all about from the start?

--- End quote ---
No it wasn't


--- Quote from: ewww on March 12, 2010, 02:28:20 pm ---Right... hehehe

I was looking for the option to compile multiple files at once in order to have optimized release builds. Since this feature in not present in cb....

--- End quote ---
C::B provides optimized builds when you use projects.... There is a release target that has -O2 switch by default.

ewww:
Then I really misunderstood the point of the original question. I am able to create projects in codeblocks and to compile just fine with compiler switches of my choice. This is not an issue.


--- Quote ---The latter scales very well on a quad-, octa-, n-core machine. Can you say the same for the former?
--- End quote ---
I haven't noticed that separate translation units would be compiled in parallel on my dual-core machine, at least not visually The output window does not indicated that in any way.

Anyways. That was not my concern. Say, take a look here http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Optimize-Options.html


--- Quote ---Using the -funit-at-a-time flag will allow the compiler to consider information gained from later functions in the file when compiling a function. Compiling multiple files at once to a single output file (and using -funit-at-a-time) will allow the compiler to use information gained from all of the files when compiling each of them.
--- End quote ---

I believe that holds true if source code is compiled the way i have shown. Of course one has to compile with -funit-at-a-time optimization switch included.

This is a very valid feature for an ide like cb is, not?

oBFusCATed:

--- Quote from: ewww on March 12, 2010, 03:01:48 pm ---I haven't noticed that separate translation units would be compiled in parallel on my dual-core machine, at least not visually The output window does not indicated that in any way.

--- End quote ---
There is an option for the number of processes to use in Settings -> Compiler and Debugger -> Compiler -> Other (I think)


--- Quote ---
--- Quote from: ewww on March 12, 2010, 03:01:48 pm ---Using the -funit-at-a-time flag will allow the compiler to consider information gained from later functions in the file when compiling a function. Compiling multiple files at once to a single output file (and using -funit-at-a-time) will allow the compiler to use information gained from all of the files when compiling each of them.
--- End quote ---

I believe that holds true if source code is compiled the way i have shown. Of course one has to include something like -O2 or -funit-at-a-time to have any benefit from it.

This is a very valid feature for an ide like cb is, not?

--- End quote ---
Can you prove that there is a gain? You can test two executables build using the two schemes and measure the difference in execution speed?

BTW, There is a chance that you'll get better speed/performance if you upgrade your compiler :)
p.s. also look at Link Time Object generation, or something like that in gcc 4.5

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version