User forums > Using Code::Blocks
[SOLVED] Meeting problem of ‘undefined reference to'
lukenothing:
I think I'm very close to the root the problem after I switch on the complier logging to 'full command line'
I will be back to show you what is going on after the gym.
lukenothing:
Hi everybody, sorry I'm late. I just solve this strange problem. The point is that the project B (libabc.a) is a static library project which compliered by gcc (means c project), and the project A(ccc) is a c++ console application project which is compliered by g++....
after I tried to use the g++ manually compliered the libabc.a, the problem was gone. Everything is OK.
So that I think it's a little BUG of Code::Blocks. For uncertain reason, when you create a static library by Code::Blocks IDE wizard, you will not have the chance to select it as a c or c++ project. However, you can do it through the proces of creating the shared library.
lukenothing:
And the question is, where can I change a project language in a static library?
lukenothing:
HAHA, everything is OK.
I right click the file in static library project B, pick the properties, then select the 'Advanced' tab in properties dialog, in Compiler variable textbox, change the CC to CPP, later on, click the OK button to close this dialog.
Then I rebuild the project B. In the Build log, I see the gcc changed to the g++...
Finally, I switch to the project A, ccc, rebuild it as well.
Now, the only requirement is that I hope there is a in-project global option to switch between CC and CPP, because with the growing of static library project, manually to set each file's properties will be an anxious problem.
Here is the source of solution. http://stackoverflow.com/questions/4695896/codeblocks-gcc-change-project-language-c-and-c
stahta01:
If you wish to do a C++ compiler do NOT name the file with a .c file extension.
--- Quote ---abc.c
--- End quote ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version