News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

extern variables "undefined reference"

Started by Dumbledore, September 15, 2008, 11:06:06 PM

Previous topic - Next topic

Dumbledore

Hi, I am brand new to codeblocks and after I installed it today I attempted to port my project hiearchy into the CB IDE.  All went better than I expected until I hit a link error that as far as I can tell is caused by a CB misconfig. 

This project compiles fine with my makefile.

Not sure what info I need to give to shed light on the problem....  The code itself is solid and both the .cpp files are in the project in the same directory...

In main.cpp  I have someVar = someVal  and in other.cpp I have "extern someVar;" 

In the "other.cpp" file the linker is saying "undefined reference to someVar"   


MortenMacFly

Quote from: Dumbledore on September 15, 2008, 11:06:06 PM
In the "other.cpp" file the linker is saying "undefined reference to someVar"   
Please post the full build log. See my sig how to enable full compiler logging.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]