Author Topic: extern variables "undefined reference"  (Read 4492 times)

Dumbledore

  • Guest
extern variables "undefined reference"
« on: September 15, 2008, 11:06:06 pm »
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"   

« Last Edit: September 15, 2008, 11:08:56 pm by Dumbledore »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: extern variables "undefined reference"
« Reply #1 on: September 16, 2008, 10:26:24 am »
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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ