Is it possible to "undefine" a feature in QT Creator? [closed] - c++

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last month.
Improve this question
I'm trying to modify an application I've completed in QT Creator so that it can be run within a browser. The majority of code in qopenglfunctions_3_2_core.h is skipped because opengles2 is defined in the following line.
#if !defined(QT_NO_OPENGL) && !QT_CONFIG(opengles2)
/*
The QT_CONFIG macro implements a safe compile time check for features of Qt.
Features can be in three states:
0 or undefined: This will lead to a compile error when testing for it
-1: The feature is not available
1: The feature is available
*/
#define QT_CONFIG(feature) (1/QT_FEATURE_##feature == 1)
With clang, QT_CONFIG(opengles2) returns 0 and the statement evaluates to true. With emscripten, QT_CONFIG(opengles2) returns 1 and the statement evaluates to false which skips the remainder of the file. I'm trying to find a workaround.

Changing
#include <QOpenGLFunctions_3_2_Core> to #include <QOpenGLFunctions_ES2> resolved the issue for me. However it seems there were some variables that did not carry over such as
GL_LINE_SMOOTH
glVertexAttribIPointer
glPointSize
If anyone knows of a fix to this please let me know. In the meantime, I'll keep digging around.

Related

assert works in bash for every input I give it even if it's wrong? how to fix this? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I wrote a code using C++ and then wrote a main file to check it, and in this main file I used an assert to check if the values I get are true or not ...
but after a while I discovered I don't get any mistake on bash even though I entered wrong values. Anyone knows why? Or why such a thing happens?
for example :
assert(numOfSegments == 1); // i don't get warning
//but also
assert(numOfSegments == 100); // also here no warning even though this is wrong
//this is how i compile in bash :
g++ -std=c++0x -DNDEBUG -g *.cpp
From https://en.cppreference.com/w/cpp/error/assert:
If NDEBUG is defined as a macro name at the point in the source code where is included, then assert does nothing.
Since you are compiling with -DNDEBUG, those statements are not doing anything at all.

graphics in c and c++ [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
In turbo c 3.2 I am getting
Divide error
and in code blocks IDE I getting error that
initgraph() and closegraph() are refrence at compile time. (I added graphics header and library file in folder of codeblocks).Please give me solution?
the code i written is
#include<graphics.h>
int main()
{
int a=10,ab;
initgraph(&a,&ab,"C:\\TURBOC3\\BGI");
circle(100,200,20);
closegraph();
return 0;
}
In addition to the backslash issue in the path, it's extremely unlikely that you are using a 3270 compatible display. Why don't you pass in the address of a with a=0. ab must be set to a requested mode unless you set the driver to autodetect, which will then select the highest available mode. See here.
The path string should be "C:\\TURBOC3\\BGI" (note the double backslashes instead of single backslashes)
I hope this solves the problem. I can't see any other error in code.

Comment blocks of code in c++ [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I'm having difficulty formulating this question, and therefore, I can't search for the answer in google.
My question is whether a function exists which can auto-comment/auto-uncomment blocks of code. Or is there a way to automatically remove or ignore certain lines when the code is built?
Maybe it can be done with directives?
It sounds like you are asking about #if which skips sections of code based on compiler settings.
Microsoft's documentation on the feature is located on MSDN note that this link may contain compiler specific rules (I didn't read through all of it).
I'm having difficulty understanding your question. Are you looking for a shortcut to automatically comment out a section of code? If so, consider this, from the Codeblocks manual:
Comment highlighted code | Ctrl-Shift-C
Uncomment highlighted code | Ctrl-Shift-X

Programatically creating and compiling from a program in C++ [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Let's say we've got a first program called Program1.exe which contains the necessary information to create and compile another application called Program2.exe. Actually it could also load that information from a txt file or whatever.
Googling, I've found that this is "easy" to do in C#, using Visual Studio:
How to programatically build and compile another c# project from the current project
Programmatically Invoke the C# Compiler
The problem is that I'm not using (and can't use) C#, but C++. Summing it up, my question is if that I can do this same thing using C++.
I would prefer to do it without additional libraries, but if that's not possible, or if it's too hard to do, you can also recommend any library allowing it.
I think you'll probably have noticed it, but my goal is to use it under Windows so I don't care if it's not portable.
Thanks everybody.
It's trivial (if maybe a bit odd) for a C++ program to compile and run another based on code stored in a text file. Debugging that other program, however, isn't.

structure reading C++ [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have the following problem:
I have a configuration file that consists a description of fields , which I read it and then parse it. I want to move it into the code to compile it inside.
How would you do that as bug structure ??? or else ?
Thanks
I wouldn't move it into the code, I'd leave the configuration file as a configuration file.
If you really must do this, you can just embed the file as a string resource into the application and use that - that way you'd change only a minimal amount of existing code. The way you do this depends upon your platform.
If thats not feasible (for whatever reason) I'd set up a single configuration class / namespace to contain all the values.
It's not very clear what are you exactly asking.
If you are looking for on-the-fly code execution (like eval() function in some languages), then there is no such thing in C++. It's not an interpreted language which can be read and executed line-by-line, it needs to be compiled every time code changes. While it technically is possible to write self-changing code, it's probably not worth the effort.