-3

Yesterday I wrote a simple program. The problem is that g++ won't compile it -

main.cpp: In function ‘void display()’:
main.cpp:32:21: error: ‘loadObj’ was not declared in this scope
  loadObj("model.obj");

I don't understand why - everything has been included. I'm trying to build it with this command

g++ -Wall -o main objLoader.cpp main.cpp -lGL -lglut -lGLU

There is a link to source: CLICK

Any ideas?

Gogetek
  • 15
  • 6

3 Answers3

2

Your include guards in ObjLoader.h are wrong.

#ifdef __OBJLOADER_H_INCLUDED__

should be

#ifndef __OBJLOADER_H_INCLUDED__

Note the n after the if. As it currently stands, the contents of the header are always ignored by all source files.

haccks
  • 104,019
  • 25
  • 176
  • 264
ComicSansMS
  • 51,484
  • 14
  • 155
  • 166
1

try declaring the function with const char*

lkanab
  • 924
  • 1
  • 7
  • 20
1

Change your safe guards in your objLoader.h to:

#ifndef __OBJLOADER_H_INCLUDED__

#ifdef is "if defined" which obviously is not.

101010
  • 41,839
  • 11
  • 94
  • 168