Sam
Sam

Reputation: 238

is there a way to list symbols that are defined in c/c++ by #define

I am using eclipse and keep getting an undefined reference to `__assert_func' error in my c/c++ code.

I am wondering if there is a way to tell what is being defined ( # define **). I can manually go through my files, but I am working with a lot of them and this would take a while. Is there a compiler option or a tool that could list these for me?

Thanks,

Sam

Upvotes: 0

Views: 748

Answers (3)

Mats Petersson
Mats Petersson

Reputation: 129454

You can usually produce the pre-processor output from the compiler - e.g. g++ -E myprog.cpp > myprog.i. I think CL -E does the same thing in Visual Studio, and other compilers tend to have a similar option.

It does sound like your missing function is part of a ASSERT or assert macro.

Upvotes: 1

Csq
Csq

Reputation: 5855

Undefined reference has nothing to do with #defines. It is a linker error, you may have forgotten to link against a .lib/.a file.

Upvotes: 1

James McDonnell
James McDonnell

Reputation: 3710

This is dependent on the compiler. You can read this if you're running GCC.

GCC dump preprocessor defines

Upvotes: 3

Related Questions