Author Topic: [not SOLVED] How do I change specific files compiling policy from Code::Blocks?  (Read 3413 times)

Offline iQChange

  • Single posting newcomer
  • *
  • Posts: 3
I have a project. For some files, instead of standard compilation process, I want to build them with some other flags. How do I do it?
« Last Edit: February 18, 2015, 01:12:46 am by iQChange »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: How do I change specific files compiling policy from Code::Blocks?
« Reply #1 on: February 17, 2015, 07:35:37 pm »
Right click on the file, properties and have a look how to adjust.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline iQChange

  • Single posting newcomer
  • *
  • Posts: 3
Re: How do I change specific files compiling policy from Code::Blocks?
« Reply #2 on: February 18, 2015, 12:34:34 am »
Thank you so much!

Offline iQChange

  • Single posting newcomer
  • *
  • Posts: 3
My wish is to get a dll from one file and with the other's code, call functions inside it (dynamic loading).
Anyway, I must change the way it's built. It runs
Code
g++.exe -shared -std=c++14 C:\proj\cpp\test\test_project\test.cpp -Wall -fexceptions -o test.dll
g++.exe  -o bin\Debug\test_project.exe obj\Debug\main.o obj\Debug\test.o   

But I don't want to create an invalid test_project.exe. I want to get the rid of test.o. How do I do it?

Online stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Create a separate CB target to create the DLL.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Look in project->settings under build targets (or something with target)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
iQChange:
You can disable linking of test.cpp. It is not recommended to do it this way, because this is not the way the build system is designed to work.
You are abusing it. So it is better to have two targets one for the dll and one for the executable as stahta01 suggested.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]