[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Windows Form application and "#include <stdlib.h>"

Posted on 2010-11-15
3
Medium Priority
?
1,255 Views
Last Modified: 2012-05-10
Hello experts,

I want to add #include <stdlib.h> to my windows form application.

I get lots of errors:

c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(234) : error C3083: 'vc_attributes': the symbol to the left of a '::' must be a type
c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(234) : error C2039: 'YesNoMaybe' : is not a member of '`global namespace''
c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(234) : error C2146: syntax error : missing ';' before identifier 'SA_YesNoMaybe'
c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(234) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(234) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(235) : error C3083: 'vc_attributes': the symbol to the left of a '::' must be a type


Why is that?

Thank you

panJames

0
Comment
Question by:panJames
  • 2
3 Comments
 
LVL 40

Expert Comment

by:evilrix
ID: 34135026
That header is deprecated, you should use "#include <cstdlib>"
0
 

Author Comment

by:panJames
ID: 34135253
Ok, added it.
This is how the beginning of my file looks like:

#pragma once


namespace OpenCVtester {

      using namespace System;
      using namespace System::ComponentModel;
      using namespace System::Collections;
      using namespace System::Windows::Forms;
      using namespace System::Data;
      using namespace System::Drawing;

      #include <cstdlib>
      #include "Headers.h"

And I get errors like:
c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(234) : error C3083: 'vc_attributes': the symbol to the left of a '::' must be a type
c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(234) : error C2039: 'YesNoMaybe' : is not a member of '`global namespace''
c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(234) : error C2146: syntax error : missing ';' before identifier 'SA_YesNoMaybe'
c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(234) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(234) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(235) : error C3083: 'vc_attributes': the symbol to the left of a '::' must be a type
c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(235) : error C2039: 'YesNoMaybe' : is not a member of '`global namespace''
c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(235) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(235) : error C2146: syntax error : missing ';' before identifier 'SA_Yes'
c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(235) : error C2377: 'OpenCVtester::YesNoMaybe' : redefinition; typedef cannot be overloaded with any other symbol
        c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(234) : see declaration of 'OpenCVtester::YesNoMaybe'



panJames
0
 
LVL 40

Accepted Solution

by:
evilrix earned 2000 total points
ID: 34135335
Ok, well it looks like you are trying to mix managed and unmanaged code, which isn't an issue as long as you are aware of this but your includes shouldn't be inside a namespace otherwise you are importing everything included by that include into that namespace. Here all the stuff in stdlib is going to be imported into the OpenCVtester namespace. Try the following:

NB. I would also avoid a single header containing all other headers (which I guess Headers.h is) - it can cause some hard to diagnose dependency issues. Only include in each translation unit what is needed by that translation unit.
#pragma once

#include <cstdlib>
#include "Headers.h"

namespace OpenCVtester {

      using namespace System;
      using namespace System::ComponentModel;
      using namespace System::Collections;
      using namespace System::Windows::Forms;
      using namespace System::Data;
      using namespace System::Drawing;

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

826 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question