Cancel
Showing results for 
Search instead for 
Did you mean: 

ITK compiling error

Creator
Creator

Hi,

 

I am using the following code shown below:

 

#include <D:\TC_ROOT\include\tc\tc.h>
#include <D:\TC_ROOT\include\tc\iman.h>
#include <D:\TC_ROOT\include\tcinit\tcinit.h>
#include <D:\TC_ROOT\include\qry\qry.h>
#include <D:\TC_ROOT\include\unidefs.h>

 

int ITK_user_main(int argc, char* argv[])
{
int iFail = ITK_ok;
iFail = ITK_auto_login();
if(iFail == ITK_ok)
{
printf("Login susscesful");
tag_t query_tag = NULLTAG;
char * qdesc = NULL;
QRY_find2("General...",&query_tag);
QRY_ask_description2(query_tag,&qdesc);
printf("%s",qdesc);
}
else
{
printf("No login");
}
iFail = ITK_exit_module(true);
return iFail;
}

 

I am compiling and linking the code manually ( not using VS). For compile i am using the following command:

%TC_ROOT%/sample/compile -DIPLIB=none ITK_Auto_Login_and_Query.c

 

but i am getting the following error during compiling the code:

ITK_Auto_Login_and_Query.c(12) : error C2275: ‘tag_t’ : illegal use of this type as an expression
ITK_Auto_Login_and_Query.c(12) : error C2146: syntax error : missing ‘;’ before identifier ‘query_tag’
ITK_Auto_Login_and_Query.c(12) : error C2065: ‘query_tag’ : undeclared identifier
ITK_Auto_Login_and_Query.c(13) : error C2143: syntax error : missing ‘;’ before’type’
ITK_Auto_Login_and_Query.c(14) : error C2065: ‘query_tag’ : undeclared identifier
ITK_Auto_Login_and_Query.c(15) : error C2065: ‘query_tag’ : undeclared identifier
ITK_Auto_Login_and_Query.c(15) : error C2065: ‘qdesc’ : undeclared identifier
ITK_Auto_Login_and_Query.c(15) : warning C4047: ‘function’ : ‘char **’ differs in levels of indirection from ‘int *’
ITK_Auto_Login_and_Query.c(15) : warning C4024: ‘QRY_ask_description2’ : different types for formal and actual parameter 2
ITK_Auto_Login_and_Query.c(16) : error C2065: ‘qdesc’ : undeclared identifier Compiler Status: 512

 

Please help me in resolving this error.

Note: I am using VS 11.3 and MSDEV_HOME i set to C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC.

 

Regards,

Zaara

3 REPLIES 3

Re: ITK compiling error

Gears Phenom Gears Phenom
Gears Phenom

I think that this solution will help you:

 

When you name your source files *.c, MSVC assumes it's compiling C, which means C89. All block-local variables need to be declared at the beginning of the block.

Workarounds include:

- declaring/initializing all local variables at the beginning of a code block (directly after an opening brace {)
- rename the source files to *.cpp or equivalent and compile as C++.

 

https://stackoverflow.com/questions/9903582/error-c2275-illegal-use-of-this-type-as-an-expression

 

Re: ITK compiling error

Creator
Creator

Hello,

 

Thanks a lot @ArthurRM. It worked and i am able to generate .exe file without any error.

 

But i got a warning message when i linked it through the command:

%TC_ROOT%/sample/linkitk -o ITK_Auto_Login_and_Query ITK_Auto_login_and_Query.obj

 

I got the following warning message:

itk_main.obj : warning LNK4204: 'D:\ITK_Practise\ITK_Auto_Login_and_Query\vc110.pdb' is missing debugging information for referencing module; linking object as if no debug info.

 

Regards,

Zaara

Re: ITK compiling error

Gears Phenom Gears Phenom
Gears Phenom

Hello, try this solution from msdn:

 

filename' is missing debugging information for referencing module; linking object as if no debug info

The .pdb file has an erroneous signature. The linker will continue to link the object without debug information. You may want to recompile the object file using the /Zi option.

LNK4204 can occur if some of the objects in the library refer to a file that no longer exists. This could happen when rebuilding the solution, for example; an object file might be deleted and not rebuilt because of a compilation error. In this case, either compile with /Z7, or /Fd, to update the objects to refer to a single file per-library (that is not the default .pdb file name). For more information, see /Fd (Program Database File Name). Ensure that the .pdb is saved with the library every time it is updated in the source control system.

 

https://msdn.microsoft.com/en-us/library/5ske5b71.aspx