Solved

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

Posted on 2010-11-15
3
1,188 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
Comment Utility
That header is deprecated, you should use "#include <cstdlib>"
0
 

Author Comment

by:panJames
Comment Utility
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 500 total points
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now