Author Topic: Is there a way to set a object file name base on the full name of the source ?  (Read 923 times)

Offline mrguo

  • Single posting newcomer
  • *
  • Posts: 2
There are two source files with a same basename in a same directory, such as : "a.cc" and "a.cu", like the sources of mxnet , During the building, there are two object files with a same name "a.o" might generate and overwrite each other, then, a lot of "undefined reference to" errors generated when try to link them together.

My questions : is there a way to set a object file name base on the full name of the source file ? in other words, can I set the C::B and let it compile the "a.cc" to "a.cc.o" and "a.cu" to "a.cu.o" , and link them together ? or is there a way to change the both $object and $link_objects command macros of C::B instead ?

Thanks!

« Last Edit: October 15, 2020, 03:58:09 am by mrguo »

Online stahta01

  • Lives here!
  • ****
  • Posts: 7103
    • My Best Post
With an CB project open.

Project -> Properties
Tab: Project Settings
Checkbox: "Object Names Generation"

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

Offline mrguo

  • Single posting newcomer
  • *
  • Posts: 2
With an CB project open.

Project -> Properties
Tab: Project Settings
Checkbox: "Object Names Generation"

Tim S.

Great, it works!

Thank Tim very much ! and C::B is very nice !