Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
142 views

I have Visual Studio 2022 and this line of code using (Excel.Application xlApp = new Excel.Application()) throws an error CS1674 'Application': type used in a using statement must implement 'System....
Charles Fleischmann's user avatar
1 vote
2 answers
93 views

Why do gcc, clang and msvc successfully compile the following code? (godbolt) namespace impl { class A; } // namespace impl namespace api { using namespace impl; } // namespace api class B { ...
Igor G's user avatar
  • 2,668
1 vote
1 answer
97 views

From cppreference : From the point of view of unqualified name lookup of any name after a using-directive and until the end of the scope in which it appears, every name from namespace-name is visible ...
Rajdeep Sindhu's user avatar
0 votes
1 answer
37 views

We're on Visual Studio Code, .NET 8 & Angular. I changed the structure of my project and now I cannot use using directive in my app, it's driving me crazy. Here is my structure: Structure Expended ...
Adrien Le Breton's user avatar
3 votes
1 answer
250 views

I last used C++ at the 98 with boost/C++11 simulation. I am reading Stroustrup's "A Tour of C++, Third Edition" to help introduct the things I will need to learn more about. Following ...
Varsuuk's user avatar
  • 39
1 vote
0 answers
47 views

The C# doc on the using directive says The using directive allows you to use types defined in a namespace without specifying the fully qualified namespace of that type. I understood this to mean ...
joseville's user avatar
  • 1,023
0 votes
0 answers
25 views

I have a VS issue, VS2022 but it also happened in the previous version. In fact its been happening for a few years. When I do certain operations, often moving files within VS, I find I get a load of ...
Craig's user avatar
  • 585
-1 votes
1 answer
83 views

I am trying to make some sort of easy way to define mcu that I use, and by defining mcu, different header files should be included. I tried doing it with #if and #elif directives : #include "...
Dominykas's user avatar
  • 161
1 vote
1 answer
50 views

In the following code will fail to compile because, despite the chain of public inheritance, HasFlag is not visible in DerivedFoo. class BasicFoo { public: bool HasFlag() const { return m_flag; } ...
Adrian McCarthy's user avatar
2 votes
1 answer
161 views

The following code (a simplified example from a more complex code) fails to compile with gcc 11.3.0 #include <array> #include <memory> #include <tuple> namespace tools { template &...
francesco's user avatar
  • 7,617
0 votes
0 answers
40 views

Using the using-directive I'm able to select a certain set of methods from the base class to put into a different access scope. Is this also possible for individual overloads of the method? Something ...
glades's user avatar
  • 5,374
-2 votes
2 answers
1k views

Heyo, basically I was writing this simple function to ask you how many cars you have, inputing the amount in the array, and assigning the names of the cars to the array aswell. Also made a for loop to ...
Sweep's user avatar
  • 11
0 votes
0 answers
553 views

I have a project with some interfaces that contains some type alias in it, for example like below: namespace UsingTest { using MyType = System.Collections.Generic.List<int>; public ...
sorosh_sabz's user avatar
  • 3,053
1 vote
1 answer
79 views

I have a .NET Framework 4.7.2 web application. I am receiving the following yellow screen error from some of my Views and Partial Views but not all of them: Expected a "{" but found a "...
bowserm's user avatar
  • 1,056
2 votes
3 answers
98 views

This is just short inquiry if it is at all possible to somehow import base class constructors without all the template bloat. Consider this example where I'm inheriting from a templated std::variant: ...
glades's user avatar
  • 5,374
0 votes
1 answer
33 views

This is what I'm trying to do: template<typename T, int I> class A { public: using CA = T::C<I>; }; class B { public: template<int I> struct C {}; }; int main() { A&...
lequinne's user avatar
  • 180
16 votes
2 answers
14k views

C#10 in .NET 6.0 supports a new feature called global using directive. It seems to do 2 things: When you have a namespace in the global using, you don't have to include the using ... for that ...
Stefan's user avatar
  • 1,367
3 votes
1 answer
261 views

Inside a function one can employ the using declaration to import a name in the current scope, like namespace A { int y; } void f() { using A::y; } A using declaration can be used in a class ...
francesco's user avatar
  • 7,617
1 vote
1 answer
381 views

I have a library - Foo.System.Management I have an application - Foo.New.Application In this application, Using System; is imported, and what ends up happening is this is being resolved to Foo.System ...
Adjit's user avatar
  • 10.3k
0 votes
1 answer
605 views

I am aware that it's not possible to alias a generic type (e.g. using Foo = Dictionary; is invalid), but that the generic type on the right must be closed (e.g. using Foo = Dictionary<int, string&...
Ernest3.14's user avatar
  • 1,022
-1 votes
1 answer
67 views

Code: #include <stdio.h> #define puts "%s C preprocessor" int main() { printf(puts, puts); return 0; } Output: %s C preprocessor C preprocessor See also... Can anyone explain ...
sakshi monst's user avatar
0 votes
0 answers
71 views

I'm using Stepzen, it generated graphql files, however, all of them with errors: stepzen/index.graphql schema @sdl(files: ["postgresql/index.graphql"]) { query: Query } stepzen/postgresql/...
Bulatron's user avatar
0 votes
1 answer
99 views

(You might see this question as a duplicate of this, but, to be honest, I've not really understood the matter, so I'm asking separately with my own wording.) [over.load]/1 reads: Not all function ...
Enlico's user avatar
  • 30.3k
2 votes
0 answers
46 views

Why cannot the using directive be used recursively in c#? using MyKey = System.String; using MyValue = System.Int32; using AllowedPair = System.Collections.Generic.KeyValuePair<System.String, ...
Tom's user avatar
  • 5,319
1 vote
2 answers
1k views

I am creating a NUnit test project and in the creation of that, MS Visual Studio has created a file called Usings.cs with the line global using NUnit.Framework; which tells the project to include the ...
suitendaal's user avatar
3 votes
1 answer
3k views

I'm deriving from a base class in which I try to define a type. That type is dependent on itself via a variant, so it would require to know the memory layout of the base class upon definition. However,...
glades's user avatar
  • 5,374
0 votes
0 answers
39 views

I'm currently switching from Java to C++ and I have troubling understaning the following problem. I have a header file for a class (AClass.h): #ifndef ACLASS_H #define ACLASS_H #include <cstdint&...
E_3's user avatar
  • 311
0 votes
0 answers
147 views

I created a class library with .Net 6.0 which looks like this: namespace MyLib { public static class MyLib { public static void someFunction() { } } } I created a nuget package and ...
TigersEye120's user avatar
0 votes
2 answers
53 views

Often in derived template classes I need to refer to the base to access members. I end up writing code like this: template<typename A> struct BaseClass { }; template<typename B> struct ...
Heisenbug's user avatar
  • 39.3k
7 votes
2 answers
433 views

I have a function in my code which only accepts a class member method as a template parameter. I need to call this method using a class method which is inherited from a parent class. Here is an ...
Toboxos's user avatar
  • 320
1 vote
2 answers
2k views

My Unity project has the Animation Rigging Package. As we all know if we write a script where we need to reference some kind of Rig we must use the namespace/using direction for this package. Here is ...
Roman Aebi's user avatar
1 vote
1 answer
168 views

I have a struct B that contains the declaration of a type anchor_point as a nested name. How can I bring anchor_point into scope in another function using the using-directive? I basically want to ...
glades's user avatar
  • 5,374
0 votes
2 answers
628 views

In short: I have a base class A_base without template parameters and a derived class A that has two. The function foo() only accepts base class objects foo() is supposed to return an object which has ...
glades's user avatar
  • 5,374
0 votes
1 answer
600 views

Can someone please explain the working of `line compiler directive in system verilog tried to read it's working from LRM but was not able to understand it
aryan tiwari's user avatar
2 votes
1 answer
410 views

I knew that this would be ambiguous #include <boost/hana/fwd/equal.hpp> #include <range/v3/algorithm/equal.hpp> #include <vector> int main() { std::vector<int> v{1,2,3}; ...
Enlico's user avatar
  • 30.3k
0 votes
1 answer
125 views

namespace A { int overloaded_f(float some_float); enum class Enum { Value }; } namespace B { int overloaded_f(A::Enum some_enum); int f(A::Enum some_enum){ using A::...
Darius's user avatar
  • 293
2 votes
2 answers
139 views

while trying to implement a metafunction, which needs to exist only if the "abs" function exists for some type, i ran into the folowing problem: Here are two examples of code i would expect ...
J.M's user avatar
  • 337
0 votes
3 answers
3k views

Please excuse my basic question and poor programming knowledge. I have an implementation that I need to use in many of my projects. But the included header files are different for different projects. ...
SSR's user avatar
  • 21
4 votes
2 answers
3k views

I am reading some code snippets from others and I find a line: using namespace::std; I suspect its purpose is using namespace std;, with some typos. But to my surprise the compiler accepts this code ...
rustyhu's user avatar
  • 2,235
10 votes
1 answer
1k views

Is there a consensus within the C# development community on the .cs filename in which global using statements are declared? I was going to adopt the filename GlobalUsings.cs but then found that a ...
camelCase's user avatar
  • 1,830
1 vote
3 answers
866 views

No error occurs when using using namespace std; and std::cout together. Can these two be used together? #include <iostream> using namespace std; int main() { std::cout << "...
kev's user avatar
  • 19
2 votes
0 answers
2k views

I'm getting this error in Visual Studio Community 2022 (64-bit) on Windows 10 Pro: CS0246 - The type or namespace name 'Android' could not be found (are you missing a using directive or an assembly ...
Ola Ström's user avatar
  • 5,479
1 vote
2 answers
167 views

I have come to understand why using namespace std; is considered bad practice in c++ but let's consider for example 2 ( hypothetical ) libraries "std" and "sfd" , both of them ...
Ken Za's user avatar
  • 81
1 vote
0 answers
54 views

Here are a demo code from C++ primer plus about using using-directive and using-declaration across header files and cpp files, I've made some modification to remove the using declarations in other ...
lyu.l's user avatar
  • 312
1 vote
2 answers
145 views

using namespace X; cout << var; using Y::var; cout << var; So say I have a namespace X and a namespace Y that both contain a variable of type int called var. When I say using ...
jaylse2's user avatar
  • 71
1 vote
1 answer
3k views

I have a mask-phone directive that works perfectly in the input when the user write a value, but I need to set a default value and I don't know how to apply the mask directive in the component method. ...
Perez Ch's user avatar
1 vote
1 answer
337 views

To understand more using directives and function overloading I've tried this program: namespace ns{ void f(int){cout << "int\n";} void f(double){cout << "double\n&...
Itachi Uchiwa's user avatar
2 votes
2 answers
1k views

In addition to allowing importing of all types within a namespace, the using directive in C# allows importing of a single type via an alias (e.g. using A = Something.A;) or importing all static ...
teichert's user avatar
  • 4,853
2 votes
1 answer
106 views

this program works correctly but when I separate that "Class StudentsName" and put it on the header file it doesn't work correctly. I add the header file in my project by right click on the ...
asipoolika's user avatar
2 votes
1 answer
233 views

Why is the using directive using namespace std; in when enclosed in an anonymous namespace behaves as if it appeared at global scope? #include <iostream> namespace x { using namespace std; ...
zdf's user avatar
  • 4,898

1
2 3 4 5 6