user2035796
user2035796

Reputation: 67

Linking header files in codeblocks

So I've written code in OpenCV which contains 2 header files using Code::Blocks. When I compile the files, there are no errors except two "undefined reference..." errors which occur because I have used functions that I have declared in the header files. I assumed that code blocks automatically linked the header files? I have used the "#include.." to include the header files at the top of the programs so not sure what the problem could be. Anyone have any idea? Thanks.

Upvotes: 2

Views: 9768

Answers (1)

Tonia Sanzo
Tonia Sanzo

Reputation: 355

I was having a similar problem, but happened upon a solution

  1. Click the "Project" tab, it's in the top right side.

  2. Within the "Project" tab click the "Add Files..." option.

  3. Highlight your Header file and any other files associated with your header file, like if you put your header files definitions in a .cpp file.

  4. Compile and Run.

Hopefully this helps, it worked for me but our issues could be different.

Upvotes: 4

Related Questions